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

export class IcrHomeworkarticlesnapshoot {
  [PrimaryKeyProp]?: 'Id';
  Id!: bigint;
  HomeworkId!: bigint;
  BookId!: bigint;
  StudentId!: bigint;
  BookArticleId!: bigint;
  ReadingTime!: bigint;
  WordCount!: number;
  Content?: unknown;
  AnswerPage?: unknown;
  Date!: string;
  Revision!: number;
  CreatedBy?: bigint;
  CreatedTime!: Date;
  UpdatedBy?: bigint;
  UpdatedTime?: Date;
  IsDeleted!: unknown;
}

export const IcrHomeworkarticlesnapshootSchema = defineEntity({
  class: IcrHomeworkarticlesnapshoot,
  comment: '作业回答',
  properties: {
    Id: p.bigint().primary().name('Id').unsigned(false).autoincrement(false).comment('主键Id'),
    HomeworkId: p.bigint().name('HomeworkId').comment('作业id').index('idx_ICR_HomeworkArticleSnapshoot_01'),
    BookId: p.bigint().name('BookId').comment('书id'),
    StudentId: p.bigint().name('StudentId').comment('答题人id').index('idx_ICR_HomeworkArticleSnapshoot_02'),
    BookArticleId: p.bigint().name('BookArticleId').comment('文章Id').index('idx_ICR_HomeworkArticleSnapshoot_03'),
    ReadingTime: p.bigint().name('ReadingTime').comment('阅读时间(秒)'),
    WordCount: p.integer().name('WordCount').comment('字数'),
    Content: p.array().name('Content').length(4294967295).nullable().comment('内容(json)'),
    AnswerPage: p.array().name('AnswerPage').length(4294967295).nullable().comment('文章下所有回答页'),
    Date: p.date().name('Date').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('是否删除'),
  },
});
