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

export class ScsCarousel {
  [PrimaryKeyProp]?: 'Id';
  Id!: IType<number, bigint>;
  Url?: string;
  JumpId?: IType<number, bigint>;
  JumpType?: number;
  Platform!: number;
  Type!: number;
  Enabled!: unknown;
  Revision!: number;
  CreatedBy?: IType<number, bigint>;
  CreatedTime!: Date;
  UpdatedBy?: IType<number, bigint>;
  UpdatedTime?: Date;
  IsDeleted!: unknown;
}

export const ScsCarouselSchema = defineEntity({
  class: ScsCarousel,
  comment: '轮播图',
  properties: {
    Id: p.bigint().primary().name('Id').columnType('bigint').unsigned(false).autoincrement(false).comment('主键Id'),
    Url: p.string().name('Url').length(200).nullable().comment('图片地址'),
    JumpId: p.bigint().name('JumpId').columnType('bigint').nullable().comment('关联id'),
    JumpType: p.integer().name('JumpType').nullable().comment('跳转类型(0-消息 1课程 2资源)'),
    Platform: p.integer().name('Platform').comment('平台类型(0-手机端 1-PC端)'),
    Type: p.integer().name('Type').comment('类型(0-轮播图 1-中间轮播图)'),
    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('是否删除'),
  },
});
