# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
#   * Rearrange models' order
#   * Make sure each model has one field with primary_key=True
#   * Make sure each ForeignKey and OneToOneField has `on_delete` set to the desired behavior
#   * Remove `# managed = False  # Fixed to allow Django management` lines if you wish to allow Django to create, modify, and delete the table
# Feel free to rename the models, but don't rename db_table values or field names.
#from _typeshed import SupportsDivMod
from django.db import models
import datetime
from django.utils import timezone

from django.db.models.expressions import Combinable

from apps.common.models import BaseModel
from apps.campaigns.models import Adspots




class VastResponseGo(BaseModel): 

    ad_id = models.CharField(db_column='AD_id', max_length=20, blank=True, null=True)  # Field name made lowercase.
    
    tracking_start = models.TextField(db_column='Tracking_start', blank=True, null=True)  # Field name made lowercase.
    tracking_firstquartile = models.TextField(db_column='Tracking_firstQuartile', blank=True, null=True)  # Field name made lowercase.
    tracking_midpoint = models.TextField(db_column='Tracking_midpoint', blank=True, null=True)  # Field name made lowercase.
    tracking_thirdquartile = models.TextField(db_column='Tracking_thirdQuartile', blank=True, null=True)  # Field name made lowercase.
    tracking_complete = models.TextField(db_column='Tracking_complete', blank=True, null=True)  # Field name made lowercase.
    impression_double_click = models.TextField(blank=True, null=True)
    impression_sprintserve = models.TextField(blank=True, null=True)
    
    tracking_start_status = models.TextField(blank=True, null=True)
    tracking_firstquartile_status = models.TextField(blank=True, null=True)
    tracking_midpoint_status = models.TextField(blank=True, null=True)
    tracking_thirdquartile_status = models.TextField(blank=True, null=True)
    impression_sprintserve_status = models.TextField(blank=True, null=True)
    impression_double_click_status = models.TextField(blank=True, null=True)
    tracking_completed_status = models.TextField(blank=True, null=True)

    datetime_timestamp = models.DateTimeField(blank=True, null=True)
    datetime_string = models.CharField(max_length=20, blank=True, null=True)
    status = models.TextField(blank=True, null=True)

    vast_url = models.TextField(blank=True, null=True)
    media_file = models.TextField(blank=True, null=True)
    adspot_link = models.TextField(blank=True, null=True)
    ad_spot = models.ForeignKey(Adspots, models.DO_NOTHING, blank=True, null=True)

    class Meta:
        # managed = False  # Fixed to allow Django management
        db_table = 'VAST_response_GO'


class VastResponse(BaseModel): 
    ad_id = models.CharField(db_column='AD_id', max_length=20, blank=True, null=True)  # Field name made lowercase.
    tracking_start = models.TextField(db_column='Tracking_start', blank=True, null=True)  # Field name made lowercase.
    tracking_firstquartile = models.TextField(db_column='Tracking_firstQuartile', blank=True, null=True)  # Field name made lowercase.
    tracking_midpoint = models.TextField(db_column='Tracking_midpoint', blank=True, null=True)  # Field name made lowercase.
    tracking_thirdquartile = models.TextField(db_column='Tracking_thirdQuartile', blank=True, null=True)  # Field name made lowercase.
    tracking_complete = models.TextField(db_column='Tracking_complete', blank=True, null=True)  # Field name made lowercase.
    datetime_timestamp = models.DateTimeField(blank=True, null=True)
    datetime_string = models.CharField(max_length=20, blank=True, null=True)
    status = models.TextField(blank=True, null=True)
    vast_url = models.TextField(blank=True, null=True)
    impression_double_click = models.TextField(blank=True, null=True)
    impression_sprintserve = models.TextField(blank=True, null=True)
    tracking_start_status = models.TextField(blank=True, null=True)
    tracking_firstquartile_status = models.TextField(blank=True, null=True)
    tracking_midpoint_status = models.TextField(blank=True, null=True)
    tracking_thirdquartile_status = models.TextField(blank=True, null=True)
    impression_sprintserve_status = models.TextField(blank=True, null=True)
    impression_double_click_status = models.TextField(blank=True, null=True)
    tracking_completed_status = models.TextField(blank=True, null=True)
    ad_spot = models.ForeignKey(Adspots, on_delete=models.CASCADE, related_name="vast_responses", blank=True, null=True)
    
    def __str__(self):
        return str(self.tracking_complete)

    class Meta:
        # managed = False  # Fixed to allow Django management
        db_table = 'VAST_response'
    

class VastResponse2910(BaseModel): 
    ad_id = models.CharField(db_column='AD_id', max_length=20, blank=True, null=True)  # Field name made lowercase.
    tracking_start = models.TextField(db_column='Tracking_start', blank=True, null=True)  # Field name made lowercase.
    tracking_firstquartile = models.TextField(db_column='Tracking_firstQuartile', blank=True, null=True)  # Field name made lowercase.
    tracking_midpoint = models.TextField(db_column='Tracking_midpoint', blank=True, null=True)  # Field name made lowercase.
    tracking_thirdquartile = models.TextField(db_column='Tracking_thirdQuartile', blank=True, null=True)  # Field name made lowercase.
    tracking_complete = models.TextField(db_column='Tracking_complete', blank=True, null=True)  # Field name made lowercase.
    datetime_timestamp = models.DateTimeField(blank=True, null=True)
    datetime_string = models.CharField(max_length=20, blank=True, null=True)
    status = models.TextField(blank=True, null=True)
    vast_url = models.TextField(blank=True, null=True)
    impression_double_click = models.TextField(blank=True, null=True)
    impression_sprintserve = models.TextField(blank=True, null=True)
    tracking_start_status = models.TextField(blank=True, null=True)
    tracking_firstquartile_status = models.TextField(blank=True, null=True)
    tracking_midpoint_status = models.TextField(blank=True, null=True)
    tracking_thirdquartile_status = models.TextField(blank=True, null=True)
    impression_sprintserve_status = models.TextField(blank=True, null=True)
    impression_double_click_status = models.TextField(blank=True, null=True)
    tracking_completed_status = models.TextField(blank=True, null=True)
    media_file = models.TextField(blank=True, null=True)
    adspot_link = models.TextField(blank=True, null=True)

    class Meta:
        # managed = False  # Fixed to allow Django management
        db_table = 'VAST_RESPONSE_29_10'


class AdslotsVisionr(BaseModel): 
    adid = models.CharField(db_column='AdId', max_length=255)  # Field name made lowercase.
    subid = models.CharField(db_column='SubId', max_length=255)  # Field name made lowercase.
    start = models.TimeField(db_column='Start')  # Field name made lowercase.
    end = models.TimeField(db_column='End', blank=True, null=True)  # Field name made lowercase.
    startts = models.BigIntegerField(db_column='StartTs', blank=True, null=True)  # Field name made lowercase.
    endts = models.BigIntegerField(db_column='EndTs', blank=True, null=True)  # Field name made lowercase.
    cut = models.IntegerField(db_column='Cut', blank=True, null=True)  # Field name made lowercase.
    scenario = models.TextField(db_column='Scenario', blank=True, null=True)  # Field name made lowercase.
    duration = models.IntegerField(db_column='Duration', blank=True, null=True)  # Field name made lowercase.
    ispub = models.IntegerField(db_column='IsPub', blank=True, null=True)  # Field name made lowercase.
    title = models.TextField(db_column='Title', blank=True, null=True)  # Field name made lowercase.
    replacementadid = models.CharField(db_column='ReplacementAdId', max_length=255, blank=True, null=True)  # Field name made lowercase.
    replacementpath = models.CharField(db_column='ReplacementPath', max_length=255, blank=True, null=True)  # Field name made lowercase.
    replacementduration = models.IntegerField(db_column='ReplacementDuration', blank=True, null=True)  # Field name made lowercase.
    status = models.CharField(db_column='Status', max_length=50, blank=True, null=True)  # Field name made lowercase.
    updatesent = models.IntegerField(db_column='UpdateSent', blank=True, null=True)  # Field name made lowercase.
    playlistdate = models.DateField(db_column='PlaylistDate', blank=True, null=True)  # Field name made lowercase.
    channel_id = models.IntegerField(db_column='Channel_ID', blank=True, null=True)  # Field name made lowercase.

    class Meta:
        unique_together = ('subid', 'playlistdate',)
        # managed = False  # Fixed to allow Django management
        db_table = 'AdSlots_VisionR'


class AlmaAds(BaseModel): 
    name = models.CharField(max_length=255, blank=True, null=True)
    ads_path = models.CharField(max_length=255, blank=True, null=True)
    duration = models.CharField(max_length=255, blank=True, null=True)

    class Meta: 
        db_table = 'Alma_Ads'


class Trackinglink(BaseModel): 
    spot = models.CharField(max_length=250)
    url = models.CharField(max_length=500)
    status_code = models.IntegerField(blank=True, null=True)
    request_count = models.IntegerField(blank=True, null=True)

    class Meta: 
        db_table = 'TrackingLink'

