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

@Entity('system_config')
export class SystemConfig {
  @PrimaryGeneratedColumn({ name: 'id', type: 'int', unsigned: true })
  id!: number;

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

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

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

  @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;

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

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