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

@Entity("faq_items")
export class FaqItem {
  @PrimaryGeneratedColumn("uuid")
  id!: string;

  @Column({ type: "varchar", length: 500 })
  question!: string;

  @Column({ type: "longtext" })
  answer!: string;

  // JSON array of page titles this FAQ is tagged to (e.g. '["Website
  // (Landing Page)"]') — an FAQ can be tagged to more than one page. Stored
  // as a JSON string in a TEXT column, same pattern as a "faq-selection"
  // content block; service methods parse/stringify this on the way in/out,
  // see parsePages() in faq.service.ts. NULL/empty means untagged.
  @Column({ type: "text", nullable: true })
  pages!: string | null;

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

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