import { BaseEntity } from '../../base/entity/base';
import { Column, Entity, Index } from 'typeorm';

/**
 * 设备告警消息
 */
@Entity('t_push_device_alarm')
export class PushDevicealarmEntity extends BaseEntity {
  @Index()
  @Column({ comment: '设备序列号' })
  devSerial: string;

  @Column({ comment: '通道号' })
  channelNo: string;

  @Column({ comment: '报警消息ID' })
  alarmId: string;

  @Column({ comment: '报警时间戳' })
  alarmTime: string;

  @Column({ comment: '报警类型' })
  alarmType: string;

  @Column({ comment: '通道名称' })
  channelName: string;

  @Column({ comment: '通道类型', dict: ['视频通道', 'IO通道'], default: 0 })
  channelType: number;

  @Column({ comment: '加密密码', nullable: true })
  checksum: string;

  @Column({ comment: '图片加密类型', dict: ['不加密', '用户加密', '平台加密'], default: 0 })
  crypt: number;

  @Column({ comment: '自定义信息', nullable: true })
  customInfo: string;

  @Column({ comment: '自定义协议类型', nullable: true })
  customType: string;

  @Column({ comment: '告警描述', nullable: true })
  describe: string;

  @Column({ comment: '位置信息', nullable: true })
  location: string;

  @Column({ comment: '关联ID', nullable: true })
  relationId: string;

  @Column({ comment: '报警状态', dict: ['开始', '停止'], default: 0 })
  status: number;

  @Column({ comment: '告警图片列表', type: 'json', nullable: true })
  pictureList: Array<{ url: string; id: string }>;
}