# coding:utf-8
from djongo import models


# 监控设备播放地址：
class MongoCameraData(models.Model):
    id = models.AutoField(primary_key=True)
    device_id = models.CharField(max_length=50, default='')  # 设备id
    addtime = models.IntegerField(default=0)  # 新增时间
    uptime = models.IntegerField(default=0)  # 修改时间
    status = models.PositiveIntegerField(u'设备状态 1在线 0离线',default=1)  # 设备状态 1在线 0离线
    device_info = models.TextField(u'播放地址',default='')
    # 0 不支持 1支持
    camera_playback = models.CharField(u'是否支持回放', max_length=10,default=0)
    account_id = models.CharField(max_length=50, default=1)  # 账号id
    class Meta:
        db_table = "sa_device_camera"


# 监控照片表
class MongoCameraPhoto(models.Model):
    id = models.AutoField(primary_key=True)
    device_id = models.CharField(max_length=50, default='')  # 设备id
    addtime = models.IntegerField(default=0)  # 新增时间
    addr = models.CharField(u'照片路径', max_length=200, blank=True, null=True)
    photo_status = models.PositiveIntegerField(default=1)  # 照片状态 默认为1正常 4为删除
    class Meta:
        db_table = "sa_device_camera_photo"


# 监控萤石账号
class MongoCameraAccount(models.Model):
    id = models.AutoField(primary_key=True)
    account = models.CharField(u'账号', max_length=30, default=0)
    token = models.CharField(u'token', max_length=80, default=0)   # 七天有效期
    addtime = models.IntegerField(default=0)  # 新增时间
    uptime = models.IntegerField(default=0)  # 修改时间
    app_key = models.CharField(u'用户账号appkey',max_length=50, default=0)  # 用户账号appkey
    app_secret = models.CharField(u'用户账号appsecret',max_length=50, default=0)  #用户账号appsecret
    salesman = models.CharField(u'业务员',max_length=50, default=0)  #业务员
    account_type = models.IntegerField(default=0)  # 0海康萤石云账号  1大华乐橙云账号

    class Meta:
        db_table = "sa_device_camera_account"

