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

export class ScsSitemessage {
  [PrimaryKeyProp]?: 'Id';
  Id!: bigint;
  Title?: string;
  Description?: string;
  Content?: string;
  IsImportant!: unknown;
  Revision!: number;
  CreatedBy?: bigint;
  CreatedTime!: Date;
  UpdatedBy?: bigint;
  UpdatedTime?: Date;
  IsDeleted!: unknown;
  Status: number & Opt = 0;
  Type: number & Opt = 0;
}

export const ScsSitemessageSchema = defineEntity({
  class: ScsSitemessage,
  comment: '系统消息',
  properties: {
    Id: p.bigint().primary().name('Id').unsigned(false).autoincrement(false).comment('主键Id'),
    Title: p.string().name('Title').length(100).nullable().comment('消息标题'),
    Description: p.string().name('Description').length(500).nullable().comment('描述'),
    Content: p.string().name('Content').length(20000).nullable().comment('消息内容'),
    IsImportant: p.array().name('IsImportant').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('是否删除'),
    Status: p.integer().name('Status').comment('发布状态(0未发布 1已发布 -1已撤回)'),
    Type: p.integer().name('Type').comment('类型0-富文本消息 1-url消息'),
  },
});
