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

export class IcrDotmatrixpage {
  [PrimaryKeyProp]?: 'Id';
  Id!: bigint;
  PageNo?: string;
  DotMatrixNotebookId!: bigint;
  AreaPoints?: string;
  WidthDotMatrix!: number;
  HightDotMatrix!: number;
  WidthMillimeter!: number;
  HightMillimeter!: number;
  PreviewUrl?: string;
  AbsoluteLocation?: string;
  Remark?: string;
  Revision!: number;
  CreatedBy?: bigint;
  CreatedTime!: Date;
  UpdatedBy?: bigint;
  UpdatedTime?: Date;
  IsDeleted!: unknown;
  Area?: string;
  DotId?: bigint;
  PageNum: number & Opt = 0;
}

export const IcrDotmatrixpageSchema = defineEntity({
  class: IcrDotmatrixpage,
  comment: '点阵页',
  properties: {
    Id: p.bigint().primary().name('Id').unsigned(false).autoincrement(false).comment('主键Id'),
    PageNo: p.string().name('PageNo').nullable().comment('页点阵码'),
    DotMatrixNotebookId: p.bigint().name('DotMatrixNotebookId').comment('点阵本Id'),
    AreaPoints: p.text().name('AreaPoints').length(65535).nullable().comment('答题区域（文本Json）'),
    WidthDotMatrix: p.integer().name('WidthDotMatrix').comment('点阵宽'),
    HightDotMatrix: p.integer().name('HightDotMatrix').comment('点阵高'),
    WidthMillimeter: p.float().name('WidthMillimeter').comment('宽毫米'),
    HightMillimeter: p.float().name('HightMillimeter').comment('高毫米'),
    PreviewUrl: p.string().name('PreviewUrl').nullable().comment('预览地址(页背景图)'),
    AbsoluteLocation: p.string().name('AbsoluteLocation').nullable().comment('点阵区域在当前页的绝对坐标'),
    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('是否删除'),
    Area: p.text().name('Area').length(65535).nullable().comment('区域'),
    DotId: p.bigint().name('DotId').nullable().comment('点阵id').defaultRaw(`0`),
    PageNum: p.integer().name('PageNum').comment('点阵页页码'),
  },
});
