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

export class IcrLearnreport {
  [PrimaryKeyProp]?: 'Id';
  Id!: IType<number, bigint>;
  StudentId!: IType<number, bigint>;
  StartDate!: string;
  EndDate!: string;
  HomeworkIds?: unknown;
  PreLearnTimeRate!: number;
  PreAccuracyRate!: number;
  AccuracyRate!: number;
  Type!: number;
  Detail?: any;
  Revision!: number;
  CreatedBy?: IType<number, bigint>;
  CreatedTime!: Date;
  UpdatedBy?: IType<number, bigint>;
  UpdatedTime?: Date;
  IsDeleted!: unknown;
}

export const IcrLearnreportSchema = defineEntity({
  class: IcrLearnreport,
  comment: '学情报告',
  properties: {
    Id: p.bigint().primary().name('Id').columnType('bigint').unsigned(false).autoincrement(false).comment('主键Id'),
    StudentId: p.bigint().name('StudentId').columnType('bigint').comment('学生Id'),
    StartDate: p.date().name('StartDate').comment('开始时间'),
    EndDate: p.date().name('EndDate').comment('结束时间'),
    HomeworkIds: p.array().name('HomeworkIds').length(4294967295).nullable().comment('作业Ids'),
    PreLearnTimeRate: p.float().name('PreLearnTimeRate').comment('作答时长率(较上次百分比 -为降低)'),
    PreAccuracyRate: p.float().name('PreAccuracyRate').comment('正确率(较上次百分比 -为降低)'),
    AccuracyRate: p.float().name('AccuracyRate').comment('正确率(较上次 -为降低)'),
    Type: p.integer().name('Type').comment('类型 1:天 2:周'),
    Detail: p.json().name('Detail').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('是否删除'),
  },
});
