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

export class IcrTutorroom {
  [PrimaryKeyProp]?: 'Id';
  Id!: bigint;
  Name?: string;
  TotalPen!: number;
  Enabled!: unknown;
  Revision!: number;
  CreatedBy?: bigint;
  CreatedTime!: Date;
  UpdatedBy?: bigint;
  UpdatedTime?: Date;
  IsDeleted!: unknown;
  TeacherId!: bigint & Opt;
  TotalStudent: number & Opt = 0;
}

export const IcrTutorroomSchema = defineEntity({
  class: IcrTutorroom,
  comment: '辅导班',
  properties: {
    Id: p.bigint().primary().name('Id').unsigned(false).autoincrement(false).comment('主键Id'),
    Name: p.string().name('Name').nullable().comment('考场名称'),
    TotalPen: p.integer().name('TotalPen').comment('笔的数量'),
    Enabled: p.array().name('Enabled').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('是否删除'),
    TeacherId: p.bigint().name('TeacherId').comment('管理教师').defaultRaw(`0`),
    TotalStudent: p.integer().name('TotalStudent').comment('学生的数量'),
  },
});
