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

export class IcrHomeworkperusal {
  [PrimaryKeyProp]?: 'Id';
  Id!: IType<number, bigint>;
  StudentId!: IType<number, bigint>;
  StartDate!: string;
  EndDate!: string;
  BookCount!: number;
  ArticleCount!: number;
  ReadingTime!: IType<number, bigint>;
  WordCount!: number;
  Detail?: any;
  AiInterpret?: string;
  Type!: number;
  Revision!: number;
  CreatedBy?: IType<number, bigint>;
  CreatedTime!: Date;
  UpdatedBy?: IType<number, bigint>;
  UpdatedTime?: Date;
  IsDeleted!: unknown;
}

export const IcrHomeworkperusalSchema = defineEntity({
  class: IcrHomeworkperusal,
  properties: {
    Id: p.bigint().primary().name('Id').columnType('bigint').unsigned(false).autoincrement(false).comment('主键Id'),
    StudentId: p.bigint().name('StudentId').columnType('bigint').comment('学生Id').index('idx_ICR_HomeworkPerusal_03'),
    StartDate: p.date().name('StartDate').comment('开始日期').index('idx_ICR_HomeworkPerusal_01'),
    EndDate: p.date().name('EndDate').comment('结束日期').index('idx_ICR_HomeworkPerusal_02'),
    BookCount: p.integer().name('BookCount').comment('书数量'),
    ArticleCount: p.integer().name('ArticleCount').comment('文章数量'),
    ReadingTime: p.bigint().name('ReadingTime').columnType('bigint').comment('阅读时间'),
    WordCount: p.integer().name('WordCount').comment('阅读字数'),
    Detail: p.json().name('Detail').nullable().comment('详情'),
    AiInterpret: p.string().name('AiInterpret').nullable().comment('AI解读'),
    Type: p.integer().name('Type').comment('类型(1-周报，2-周报 3-月报 4-期报)'),
    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('是否删除'),
  },
});
