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

export class ScsManager {
  [PrimaryKeyProp]?: 'Id';
  Id!: IType<number, bigint>;
  Account?: string;
  Name?: string;
  Pwd?: string;
  Phone?: string;
  Enabled!: unknown;
  Revision!: number;
  CreatedBy?: IType<number, bigint>;
  CreatedTime!: Date;
  UpdatedBy?: IType<number, bigint>;
  UpdatedTime?: Date;
  IsDeleted!: unknown;
  UnionId?: string;
  MpOpenId?: string;
  ServiceOpenId?: string;
}

export const ScsManagerSchema = defineEntity({
  class: ScsManager,
  comment: '管理员表',
  properties: {
    Id: p.bigint().primary().name('Id').columnType('bigint').unsigned(false).autoincrement(false).comment('主键Id'),
    Account: p.string().name('Account').length(30).nullable().comment('编号'),
    Name: p.string().name('Name').length(30).nullable().comment('用户名'),
    Pwd: p.string().name('Pwd').length(20).nullable().comment('用户密码'),
    Phone: p.string().name('Phone').length(20).nullable().comment('用户电话'),
    Enabled: p.array().name('Enabled').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('是否删除'),
    UnionId: p.string().name('UnionId').length(100).nullable().comment('UnionId'),
    MpOpenId: p.string().name('MpOpenId').length(100).nullable().comment('小程序OpenId'),
    ServiceOpenId: p.string().name('ServiceOpenId').length(100).nullable().comment('服务号OpenId'),
  },
});
