import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from 'typeorm';

@Entity('tenant_mt')
export class TenantEntityMt {
  @PrimaryGeneratedColumn({ unsigned: true })
  id!: number;

  @Column({ name: 'name', type: 'varchar', length: 255, nullable: true, comment: '租户名称' })
  name!: string | null;

  @Column({ name: 'code', type: 'varchar', length: 50, unique: true, comment: '租户代码' })
  code!: string;

  @Column({ name: 'phone', type: 'char', length: 11, nullable: true, comment: '联系电话' })
  phone!: string | null;

  @Column({ name: 'contact_name', type: 'varchar', length: 20, nullable: true, comment: '联系人姓名' })
  contactName!: string | null;

  @Column({ name: 'status', type: 'smallint', unsigned: true, default: 1, comment: '状态 1启用 2禁用' })
  status!: number;

  @Column({ name: 'config', type: 'json', nullable: true, comment: '租户配置' })
  config!: Record<string, any> | null;

  @Column({ name: 'rsa_public_key', type: 'varchar', length: 2000, nullable: true, comment: '公钥' })
  rsaPublicKey!: string | null;

  @Column({ name: 'aes_key', type: 'varchar', length: 32, nullable: true, comment: 'aes秘钥' })
  aesKey!: string | null;

  @CreateDateColumn({ name: 'created_at', type: 'timestamp', comment: '创建时间' })
  createdAt!: Date;

  @UpdateDateColumn({ name: 'updated_at', type: 'timestamp', comment: '更新时间' })
  updatedAt!: Date;

  @Column({ name: 'created_by', type: 'int', unsigned: true, nullable: true, comment: '创建用户ID' })
  createdBy!: number | null;

  @Column({ name: 'updated_by', type: 'int', unsigned: true, nullable: true, comment: '更新用户ID' })
  updatedBy!: number | null;
}