import { type Opt, PrimaryKeyProp, defineEntity, p } from '@mikro-orm/core';

export class IcrDotmatrixpen {
  [PrimaryKeyProp]?: 'Id';
  Id!: bigint;
  SerialNo?: string;
  Status!: number;
  Remark?: string;
  Revision!: number;
  CreatedBy?: bigint;
  CreatedTime!: Date;
  UpdatedBy?: bigint;
  UpdatedTime?: Date;
  IsDeleted!: unknown;
  ClassId!: bigint & Opt;
  Power: number & Opt = 0;
  OnlineStatus!: unknown & Opt;
  OnlineTime!: Date & Opt;
}

export const IcrDotmatrixpenSchema = defineEntity({
  class: IcrDotmatrixpen,
  comment: '笔',
  properties: {
    Id: p.bigint().primary().name('Id').unsigned(false).autoincrement(false).comment('主键Id'),
    SerialNo: p.string().name('SerialNo').nullable().comment('唯一序列号').unique('idx_ICR_DotMatrixPen_01'),
    Status: p.integer().name('Status').comment('状态;1 启用 0 禁用'),
    Remark: p.string().name('Remark').nullable().comment('备注'),
    Revision: p.integer().name('Revision').comment('乐观锁'),
    CreatedBy: p.bigint().name('CreatedBy').nullable().comment('创建者用户Id'),
    CreatedTime: p.datetime().name('CreatedTime').length(3).comment('创建时间'),
    UpdatedBy: p.bigint().name('UpdatedBy').nullable().comment('修改者用户Id'),
    UpdatedTime: p.datetime().name('UpdatedTime').length(3).nullable().comment('修改时间'),
    IsDeleted: p.array().name('IsDeleted').comment('是否删除'),
    ClassId: p.bigint().name('ClassId').comment('班级Id').defaultRaw(`0`).index('idx_ICR_DotMatrixPen_02'),
    Power: p.integer().name('Power').comment('电量'),
    OnlineStatus: p.array().name('OnlineStatus').comment('在线状态').defaultRaw(`b'0'`),
    OnlineTime: p.datetime().name('OnlineTime').length(3).comment('在线时间').defaultRaw(`0001-01-01 00:00:00.000`),
  },
});
