from django.db import models

from coresite.mixin import AbstractTimeStampModel
from apps.calls.models import Call
from apps.companies.models import Company
from apps.calls.constants import BotType

class Appointment(AbstractTimeStampModel):
    BOT_TYPE_CHOICES = [
        (BotType.SALES_BOT.value, 'Sales Bot'),
        (BotType.SERVICE_BOT.value, 'Service Bot'),
    ]
    name = models.CharField(max_length=255)
    scheduled_date = models.DateTimeField()
    offtime = models.SmallIntegerField(null=True, blank=True)
    appointment_phone = models.CharField(max_length=255, null=True, blank=True) # Phone number of the appointment i.e. appointment is booked against this number rather than actual calling number of the person
    bot_type = models.SmallIntegerField(null=True, choices=BOT_TYPE_CHOICES)
    call = models.ForeignKey(Call, on_delete=models.SET_NULL, null=True, blank=True)
    company = models.ForeignKey(Company, on_delete=models.SET_NULL, null=True, blank=True)
    twilio_call_sid = models.CharField(max_length=255)