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

export class IcrHomeworkanswerexplain {
  [PrimaryKeyProp]?: 'Id';
  Id!: IType<number, bigint>;
  HomeworkId!: IType<number, bigint>;
  StudentId!: IType<number, bigint>;
  QuestionId!: IType<number, bigint>;
  AudioStartTime!: IType<number, bigint>;
  AudioEndTime!: IType<number, bigint>;
  AudioUrl?: string;
  PointsUrl?: string;
  OperatorId!: IType<number, bigint>;
  Revision!: number;
  CreatedBy?: IType<number, bigint>;
  CreatedTime!: Date;
  UpdatedBy?: IType<number, bigint>;
  UpdatedTime?: Date;
  IsDeleted!: unknown;
  Case: number & Opt = 0;
  Status: number & Opt = 0;
}

export const IcrHomeworkanswerexplainSchema = defineEntity({
  class: IcrHomeworkanswerexplain,
  comment: '书页问题;',
  properties: {
    Id: p.bigint().primary().name('Id').columnType('bigint').unsigned(false).autoincrement(false).comment('主键Id'),
    HomeworkId: p.bigint().name('HomeworkId').columnType('bigint').comment('作业Id'),
    StudentId: p.bigint().name('StudentId').columnType('bigint').comment('学生Id'),
    QuestionId: p.bigint().name('QuestionId').columnType('bigint').comment('问题Id'),
    AudioStartTime: p.bigint().name('AudioStartTime').columnType('bigint').comment('音频开始时间'),
    AudioEndTime: p.bigint().name('AudioEndTime').columnType('bigint').comment('音频结束时间'),
    AudioUrl: p.string().name('AudioUrl').nullable().comment('音频地址'),
    PointsUrl: p.string().name('PointsUrl').nullable().comment('点位数据地址'),
    OperatorId: p.bigint().name('OperatorId').columnType('bigint').comment('操作人Id'),
    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('是否删除'),
    Case: p.integer().name('Case').comment('0-无图 1-原问题图片 2-回答图片'),
    Status: p.integer().name('Status').comment('0-正常 1-过时(之前的)'),
  },
});
