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

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

  @Column({ name: 'customer_name', type: 'varchar', length: 255, comment: '客户姓名' })
  customerName!: string;

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

  @Column({ name: 'phone', type: 'varchar', length: 20, comment: '手机号' })
  phone!: string;

  @Column({ name: 'email', type: 'varchar', length: 255, nullable: true, comment: '邮箱地址' })
  email!: string | null;

  @Column({ name: 'project_type', type: 'varchar', length: 100, comment: '项目类型' })
  projectType!: string;

  @Column({ name: 'project_description', type: 'text', comment: '项目描述' })
  projectDescription!: string;

  @Column({ name: 'budget_range', type: 'varchar', length: 100, nullable: true, comment: '预算范围' })
  budgetRange!: string | null;

  @Column({ name: 'timeline', type: 'varchar', length: 100, nullable: true, comment: '项目时间要求' })
  timeline!: string | null;

  @Column({ name: 'status', type: 'varchar', length: 20, default: 'pending', comment: '状态：pending-待处理, processing-处理中, completed-已完成' })
  status!: string;

  @Column({ name: 'is_guest', type: 'tinyint', default: 0, comment: '是否为游客提交' })
  isGuest!: number;

  @Column({ name: 'ip_address', type: 'varchar', length: 45, nullable: true, comment: '提交IP地址' })
  ipAddress!: string | null;

  @Column({ name: 'user_agent', type: 'text', nullable: true, comment: '用户代理信息' })
  userAgent!: string | null;

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

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