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

export class ScsRolepermissions {
  [PrimaryKeyProp]?: ['id', 'roleid', 'permissionsid'];
  id!: bigint;
  roleid!: bigint;
  permissionsid!: bigint;
  revision!: number;
  createdby?: bigint;
  createdtime!: Date;
  updatedby?: bigint;
  updatedtime?: Date;
  isdeleted!: unknown;
}

export const ScsRolepermissionsSchema = defineEntity({
  class: ScsRolepermissions,
  comment: '角色权限表',
  properties: {
    id: p.bigint().primary().unsigned(false).comment('主键Id'),
    roleid: p.bigint().primary().unsigned(false).comment('角色id'),
    permissionsid: p.bigint().primary().unsigned(false).comment('权限id'),
    revision: p.integer().comment('乐观锁'),
    createdby: p.bigint().nullable().comment('创建者用户Id'),
    createdtime: p.datetime().length(3).comment('创建时间'),
    updatedby: p.bigint().nullable().comment('修改者用户Id'),
    updatedtime: p.datetime().length(3).nullable().comment('修改时间'),
    isdeleted: p.array().comment('是否删除'),
  },
});
