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

export class IcrDotmatrixnotebook {
  [PrimaryKeyProp]?: 'Id';
  Id!: IType<number, bigint>;
  Name?: string;
  Type!: number;
  WidthDotMatrix!: number;
  HightDotMatrix!: number;
  WidthMillimeter!: number;
  HightMillimeter!: number;
  PreviewUrl?: string;
  Remark?: string;
  Revision!: number;
  CreatedBy?: IType<number, bigint>;
  CreatedTime!: Date;
  UpdatedBy?: IType<number, bigint>;
  UpdatedTime?: Date;
  IsDeleted!: unknown;
  PdfUrl?: string;
  Cover?: string;
  BackCover?: string;
  BackgroundImage?: string;
  TotalPage: number & Opt = 0;
  Status: number & Opt = 0;
  Extend?: string;
  DotMatrixPdfUrl?: string;
}

export const IcrDotmatrixnotebookSchema = defineEntity({
  class: IcrDotmatrixnotebook,
  comment: '点阵本',
  properties: {
    Id: p.bigint().primary().name('Id').columnType('bigint').unsigned(false).autoincrement(false).comment('主键Id'),
    Name: p.string().name('Name').nullable().comment('名称'),
    Type: p.integer().name('Type').comment('类型;1 课堂答题卡 2 课堂答题本 3. 作业 4. 书籍  5.学生名单卡 6.草稿'),
    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('预览地址'),
    Remark: p.string().name('Remark').nullable().comment('备注'),
    Revision: p.integer().name('Revision').comment('乐观锁'),
    CreatedBy: p.bigint().name('CreatedBy').columnType('bigint').nullable().comment('创建者用户Id'),
    CreatedTime: p.datetime().name('CreatedTime').length(3).comment('创建时间'),
    UpdatedBy: p.bigint().name('UpdatedBy').columnType('bigint').nullable().comment('修改者用户Id'),
    UpdatedTime: p.datetime().name('UpdatedTime').length(3).nullable().comment('修改时间'),
    IsDeleted: p.array().name('IsDeleted').comment('是否删除'),
    PdfUrl: p.string().name('PdfUrl').nullable().comment('原始pdf地址'),
    Cover: p.string().name('Cover').nullable().comment('封面'),
    BackCover: p.string().name('BackCover').nullable().comment('封底'),
    BackgroundImage: p.string().name('BackgroundImage').nullable().comment('背景图'),
    TotalPage: p.integer().name('TotalPage').comment('总页数'),
    Status: p.integer().name('Status').comment('状态(0-草稿  1-生成中 2生成成功 -1生成失败 9-归档)'),
    Extend: p.text().name('Extend').length(65535).nullable().comment('扩展字段'),
    DotMatrixPdfUrl: p.string().name('DotMatrixPdfUrl').nullable().comment('点阵pdf地址'),
  },
});
