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

@Entity('feie_config_mt')
@Index(['tenantId'])
@Index(['tenantId', 'configKey'], { unique: true })
export class FeieConfigMt {
  @PrimaryGeneratedColumn({ unsigned: true })
  id!: number;

  @Column({ name: 'tenant_id', type: 'int', unsigned: true, comment: '租户ID' })
  tenantId!: number;

  @Column({ name: 'config_key', type: 'varchar', length: 50, comment: '配置键' })
  configKey!: string;

  @Column({ name: 'config_value', type: 'text', nullable: true, comment: '配置值' })
  configValue!: string | null;

  @Column({ name: 'config_type', type: 'varchar', length: 20, default: 'STRING', comment: '配置类型: STRING, JSON, BOOLEAN, NUMBER' })
  configType!: string;

  @Column({ name: 'description', type: 'varchar', length: 200, nullable: true, comment: '配置描述' })
  description!: string | null;

  @CreateDateColumn({ name: 'created_at', type: 'timestamp', default: () => 'CURRENT_TIMESTAMP' })
  createdAt!: Date;

  @UpdateDateColumn({ name: 'updated_at', type: 'timestamp', default: () => 'CURRENT_TIMESTAMP', onUpdate: 'CURRENT_TIMESTAMP' })
  updatedAt!: Date;
}