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

export enum IdeaStatus {
  BACKLOG = 'backlog',
  TODO = 'todo',
  IN_PROGRESS = 'in_progress',
  DONE = 'done',
  CANCELLED = 'cancelled',
}

export enum IdeaPriority {
  LOW = 'low',
  MEDIUM = 'medium',
  HIGH = 'high',
  CRITICAL = 'critical',
}

@Entity('ideas')
export class Idea {
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column()
  title: string;

  @Column({ type: 'text', nullable: true })
  description: string | null;

  @Column({
    type: 'enum',
    enum: IdeaStatus,
    default: IdeaStatus.BACKLOG,
  })
  status: IdeaStatus;

  @Column({
    type: 'enum',
    enum: IdeaPriority,
    default: IdeaPriority.MEDIUM,
  })
  priority: IdeaPriority;

  @Column({ type: 'varchar', length: 100, nullable: true })
  module: string | null;

  @Column({
    name: 'target_audience',
    type: 'varchar',
    length: 255,
    nullable: true,
  })
  targetAudience: string | null;

  @Column({ type: 'text', nullable: true })
  pain: string | null;

  @Column({ name: 'ai_role', type: 'text', nullable: true })
  aiRole: string | null;

  @Column({ name: 'verification_method', type: 'text', nullable: true })
  verificationMethod: string | null;

  @Column({ type: 'varchar', length: 20, nullable: true })
  color: string | null;

  @Column({ type: 'int', default: 0 })
  order: number;

  @CreateDateColumn({ name: 'created_at' })
  createdAt: Date;

  @UpdateDateColumn({ name: 'updated_at' })
  updatedAt: Date;
}
