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

/**
 * 车辆GPS数据
 */
@Entity('t_operation_vehicle_gps')
export class PushVehicleGpsEntity extends BaseEntity {
  @Index()
  @Column({ comment: '设备序列号' })
  sn: string;

  @Column({ comment: '消息序列号' })
  msgSeq: string;

  @Index()
  @Column({ comment: '消息创建时间', nullable: true })
  createDate: Date;

  @Index()
  @Column({ comment: '车牌号', nullable: true })
  vehicleNo: string;

   @Index()
  @Column({ comment: '归属单位' })
  departmentId: number;

  departmentName: string;

  @Column({ comment: 'GPS定位时间', nullable: true })
  gpsTime: Date;

  @Column({ comment: '经度', type: 'decimal', precision: 10, scale: 6, nullable: true })
  longitude: number;

  @Column({ comment: '纬度', type: 'decimal', precision: 10, scale: 6, nullable: true })
  latitude: number;

  @Column({ comment: '速度', type: 'decimal', precision: 5, scale: 2, nullable: true })
  speed: number;

  @Column({ comment: '方向角', type: 'int', nullable: true })
  direction: number;

  @Column({ comment: '海拔高度', type: 'decimal', precision: 6, scale: 2, nullable: true })
  elevation: number;

  @Column({ comment: '定位精度' })
  status: string;

  @Column({
    comment: '电压(V)，芯跃定位器同步；萤石云推送可空',
    type: 'decimal',
    precision: 8,
    scale: 2,
    nullable: true,
  })
  voltage: number;

  @Column({
    comment: '电量百分比，芯跃定位器同步；萤石云推送可空',
    type: 'int',
    nullable: true,
  })
  batteryPercent: number;
}