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

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

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

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

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

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