import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from 'typeorm';
import { z } from '@hono/zod-openapi';

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

  @Column({ 
    name: 'setting_key', 
    type: 'varchar', 
    length: 100, 
    unique: true,
    comment: '设置键名' 
  })
  settingKey!: string;

  @Column({ 
    name: 'setting_value', 
    type: 'text', 
    nullable: true,
    comment: '设置值' 
  })
  settingValue!: string | null;

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

  @Column({ 
    name: 'setting_type', 
    type: 'varchar', 
    length: 50, 
    default: 'string',
    comment: '设置类型: string, number, boolean, json' 
  })
  settingType!: string;

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

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