from djongo import models


class MongoWarm_Base_Info(models.Model):
    id = models.AutoField(primary_key=True)
    device_id = models.CharField(max_length=50, default='')  # 设备id
    have_camera = models.CharField(u'是否有监控', max_length=20, blank=True, null=True)
    camera_addr = models.TextField(u'播放地址',default='')
    runmode = models.CharField(u'设备运行状态', max_length=20, blank=True, null=True)
    dev_list = models.TextField(u'设备列表及名称', blank=True, null=True)
    remark = models.TextField(u'设备列表的新名称', blank=True, null=True)
    uptime = models.IntegerField(default=0)  # 修改时间

    class Meta:
        db_table = "sa_warm_base_info"


class MongoWarm_Output_Status(models.Model):
    id = models.AutoField(primary_key=True)
    device_id = models.CharField(max_length=50, default='')  # 设备id
    output = models.TextField(u'控制IO输出点状态上报', blank=True, null=True)
    remark = models.TextField(u'控制IO输出点备注', blank=True, null=True)
    uptime = models.IntegerField(default=0)  # 修改时间

    class Meta:
        db_table = "sa_warm_output_status"


class MongoWarm_Input_Status(models.Model):
    id = models.AutoField(primary_key=True)
    device_id = models.CharField(max_length=50, default='')  # 设备id
    output = models.TextField(u'控制IO输入点状态上报', blank=True, null=True)
    remark = models.TextField(u'控制IO输入点备注', blank=True, null=True)
    uptime = models.IntegerField(default=0)  # 修改时间

    class Meta:
        db_table = "sa_warm_input_status"


class MongoWarm_Weather_Status(models.Model):
    id = models.AutoField(primary_key=True)
    device_id = models.CharField(max_length=50, default='')  # 设备id
    status = models.TextField(u'气象要素', blank=True, null=True)
    uptime = models.IntegerField(default=0)  # 修改时间

    class Meta:
        db_table = "sa_warm_weather_status"


class MongoWarm_Weather_Data(models.Model):
    id = models.AutoField(primary_key=True)
    device_id = models.CharField(max_length=50, default='')  # 设备id
    data = models.TextField(u'气象要素', blank=True, null=True)
    uptime = models.IntegerField(default=0)  # 修改时间

    class Meta:
        db_table = "sa_warm_weather_data"


class MongoWarm_Switch_Status(models.Model):
    id = models.AutoField(primary_key=True)
    device_id = models.CharField(max_length=50, default='')  # 设备id
    dev_name = models.CharField(u'开关名称',max_length=50, default='')  # 设备id
    status = models.TextField(u'开关状态', blank=True, null=True)
    remark = models.TextField(u'开关状态备注', blank=True, null=True)
    uptime = models.IntegerField(default=0)  # 修改时间

    class Meta:
        db_table = "sa_warm_switch_status"


class MongoWarm_Switch_Data(models.Model):
    id = models.AutoField(primary_key=True)
    device_id = models.CharField(max_length=50, default='')  # 设备id
    data = models.TextField(u'开关状态', blank=True, null=True)
    remark = models.TextField(u'开关状态备注', blank=True, null=True)
    uptime = models.IntegerField(default=0)  # 修改时间

    class Meta:
        db_table = "sa_warm_switch_data"


class MongoWarm_Switch_Auto_His(models.Model):
    id = models.AutoField(primary_key=True)
    device_id = models.CharField(max_length=50, default='')  # 设备id
    dev_name = models.CharField(u'开关名称', max_length=20, blank=True, null=True)
    ctl_mod = models.CharField(u'控制模式', max_length=20, blank=True, null=True)
    switch_list = models.TextField(u'开关状态', blank=True, null=True)
    remark = models.TextField(u'开关状态备注', blank=True, null=True)
    uptime = models.IntegerField(default=0)  # 修改时间

    class Meta:
        db_table = "sa_warm_switch_auto_his"