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

export class IcrBookpage {
  [PrimaryKeyProp]?: 'Id';
  Id!: bigint;
  BookId!: bigint;
  BookCatalogId!: bigint;
  DotMatrixPageId!: bigint;
  PageNo?: string;
  Layout?: string;
  PageNum!: number;
  Status!: number;
  Url?: string;
  Revision!: number;
  CreatedBy?: bigint;
  CreatedTime!: Date;
  UpdatedBy?: bigint;
  UpdatedTime?: Date;
  IsDeleted!: unknown;
  Sort!: number;
  BookArticleId?: bigint;
}

export const IcrBookpageSchema = defineEntity({
  class: IcrBookpage,
  comment: '书页;',
  properties: {
    Id: p.bigint().primary().name('Id').unsigned(false).autoincrement(false).comment('主键Id'),
    BookId: p.bigint().name('BookId').comment('书Id').index('idx_ICR_BookPage_01'),
    BookCatalogId: p.bigint().name('BookCatalogId').comment('书目录id').index('idx_ICR_BookPage_02'),
    DotMatrixPageId: p.bigint().name('DotMatrixPageId').comment('点阵页id'),
    PageNo: p.string().name('PageNo').nullable().comment('点阵码'),
    Layout: p.text().name('Layout').length(65535).nullable().comment('页布局(预留字段)'),
    PageNum: p.integer().name('PageNum').comment('页码'),
    Status: p.integer().name('Status').comment('校验状态(0-未校验 1校验成功 -1校验失败)'),
    Url: p.string().name('Url').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('是否删除'),
    Sort: p.integer().name('Sort').comment('排序'),
    BookArticleId: p.bigint().name('BookArticleId').nullable().comment('书文章Id').index('idx_ICR_BookPage_03'),
  },
});
