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

export class IcrClassroomansweringresult {
  [PrimaryKeyProp]?: 'Id';
  Id!: IType<number, bigint>;
  ClassId!: IType<number, bigint>;
  ClassType!: number;
  ClassRoomCourseId!: IType<number, bigint>;
  ClassRoomQuestionId!: IType<number, bigint>;
  StudentId!: IType<number, bigint>;
  PenIds?: string;
  AnsweringResultTraceId?: string;
  Results?: string;
  Status!: number;
  Judgment!: number;
  AnsweringStartTime?: Date;
  AnsweringEndTime?: Date;
  AnsweringSeconds?: number;
  ThumbnaiImageWidth?: number;
  ThumbnaiImageHeight?: number;
  ThumbnaiImagePath?: string;
  HighdefinitionImagePath?: string;
  PenTraceId?: IType<number, bigint>;
  DotMatrixNotebookId?: IType<number, bigint>;
  DotMatrixPageId?: IType<number, bigint>;
  Remark?: string;
  Revision!: number;
  CreatedBy?: IType<number, bigint>;
  CreatedTime!: Date;
  UpdatedBy?: IType<number, bigint>;
  UpdatedTime?: Date;
  IsDeleted!: unknown;
  SchoolId!: IType<number, bigint> & Opt;
}

export const IcrClassroomansweringresultSchema = defineEntity({
  class: IcrClassroomansweringresult,
  comment: '课堂问题答题结果',
  properties: {
    Id: p.bigint().primary().name('Id').columnType('bigint').unsigned(false).autoincrement(false).comment('主键Id'),
    ClassId: p.bigint().name('ClassId').columnType('bigint').comment('班级编号'),
    ClassType: p.integer().name('ClassType').comment('班级类型'),
    ClassRoomCourseId: p.bigint().name('ClassRoomCourseId').columnType('bigint').comment('课堂课程Id'),
    ClassRoomQuestionId: p.bigint().name('ClassRoomQuestionId').columnType('bigint').comment('课堂问题Id'),
    StudentId: p.bigint().name('StudentId').columnType('bigint').comment('学生Id'),
    PenIds: p.string().name('PenIds').nullable().comment('笔Id(逗号分割)'),
    AnsweringResultTraceId: p.string().name('AnsweringResultTraceId').nullable().comment('回答笔迹Id'),
    Results: p.string().name('Results').nullable().comment('答题结果内容;["",""]'),
    Status: p.integer().name('Status').comment('答题结果状态'),
    Judgment: p.integer().name('Judgment').comment('答题结果状态判定'),
    AnsweringStartTime: p.datetime().name('AnsweringStartTime').length(3).nullable().comment('答题开始时间'),
    AnsweringEndTime: p.datetime().name('AnsweringEndTime').length(3).nullable().comment('答题结束时间'),
    AnsweringSeconds: p.integer().name('AnsweringSeconds').nullable().comment('答题耗时'),
    ThumbnaiImageWidth: p.float().name('ThumbnaiImageWidth').nullable().comment('缩略图图像宽度(毫米)'),
    ThumbnaiImageHeight: p.float().name('ThumbnaiImageHeight').nullable().comment('缩略图图像高度(毫米)'),
    ThumbnaiImagePath: p.string().name('ThumbnaiImagePath').nullable().comment('缩略图图像路径;答题过程中不断生成新的缩略图，但是地址不变'),
    HighdefinitionImagePath: p.string().name('HighdefinitionImagePath').nullable().comment('高清图图像路径;只有图片完成后才有高清图路径'),
    PenTraceId: p.bigint().name('PenTraceId').columnType('bigint').nullable().comment('笔轨迹Id;此Id关联时序数据库'),
    DotMatrixNotebookId: p.bigint().name('DotMatrixNotebookId').columnType('bigint').nullable().comment('答题的点阵本Id'),
    DotMatrixPageId: p.bigint().name('DotMatrixPageId').columnType('bigint').nullable().comment('答题的点阵页Id'),
    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('是否删除'),
    SchoolId: p.bigint().name('SchoolId').columnType('bigint').comment('学校Id').defaultRaw(`0`),
  },
});
