/**
 * UGC Generator — Types & Constants
 *
 * Alur:
 *  1. User paste link produk (Shopee, Tokopedia, website, dll)
 *  2. AI ekstrak: nama, kategori, deskripsi, pain point, manfaat, fitur
 *  3. User edit/review data yang diekstrak
 *  4. User set: platform, durasi, gaya bahasa, presenter
 *  5. AI generate UGC Package (hook, script, caption, hashtag)
 */

// ─── Platform ─────────────────────────────────────────────────────────────────
export type UGCPlatform =
  | "tiktok"
  | "shopee_video"
  | "instagram_reels"
  | "youtube_shorts"
  | "facebook_reels";

export const UGC_PLATFORMS: Record<UGCPlatform, { label: string; icon: string; durations: string[] }> = {
  tiktok:           { label: "TikTok",           icon: "📱", durations: ["15s", "30s", "60s", "3min"] },
  shopee_video:     { label: "Shopee Video",      icon: "🛍️", durations: ["15s", "30s", "60s"] },
  instagram_reels:  { label: "Instagram Reels",   icon: "📸", durations: ["15s", "30s", "60s", "90s"] },
  youtube_shorts:   { label: "YouTube Shorts",    icon: "▶️", durations: ["30s", "60s"] },
  facebook_reels:   { label: "Facebook Reels",    icon: "👥", durations: ["15s", "30s", "60s"] },
};

// ─── Gaya Bahasa ──────────────────────────────────────────────────────────────
export type UGCLanguageStyle =
  | "santai_gaul"
  | "formal_profesional"
  | "emosional_cerita"
  | "energik_hype"
  | "informatif_edukatif";

export const UGC_LANGUAGE_STYLES: Record<UGCLanguageStyle, { label: string; desc: string }> = {
  santai_gaul:          { label: "Santai / Gaul",         desc: "Kasual, akrab, cocok Gen-Z" },
  formal_profesional:   { label: "Formal / Profesional",  desc: "Sopan, kredibel, brand image" },
  emosional_cerita:     { label: "Emosional / Cerita",    desc: "Story-driven, touching, relatable" },
  energik_hype:         { label: "Energik / Hype",        desc: "High energy, excitement, viral" },
  informatif_edukatif:  { label: "Informatif / Edukatif", desc: "Edukasi, fakta, review detail" },
};

// ─── Presenter ────────────────────────────────────────────────────────────────
export type UGCPresenter = "wanita" | "pria" | "pasangan" | "grup" | "voiceover";

export const UGC_PRESENTERS: Record<UGCPresenter, { label: string; icon: string }> = {
  wanita:     { label: "Wanita",     icon: "👩" },
  pria:       { label: "Pria",       icon: "👨" },
  pasangan:   { label: "Pasangan",   icon: "👫" },
  grup:       { label: "Grup",       icon: "👥" },
  voiceover:  { label: "Voiceover",  icon: "🎙️" },
};

// ─── Hook Style ───────────────────────────────────────────────────────────────
export type UGCHookStyle =
  | "pertanyaan"       // "Pernah nggak kamu...?"
  | "shocking_fact"   // "90% orang belum tahu..."
  | "masalah_solusi"  // "Kulit sensitif? Akhirnya ada solusinya!"
  | "testimoni"       // "Udah 2 minggu pakai, hasilnya..."
  | "challenge"       // "Coba 7 hari, kalau nggak cocok..."
  | "before_after";   // "Sebelum vs sesudah pakai ini"

export const UGC_HOOK_STYLES: Record<UGCHookStyle, { label: string; example: string }> = {
  pertanyaan:    { label: "Pertanyaan",     example: '"Pernah nggak kamu ngerasa kulit makin sensitif?"' },
  shocking_fact: { label: "Shocking Fact",  example: '"90% orang salah pilih moisturizer buat kulit sensitif"' },
  masalah_solusi:{ label: "Masalah → Solusi", example: '"Kulit kemerahan terus? Akhirnya nemu solusinya!"' },
  testimoni:     { label: "Testimoni",      example: '"Udah 2 minggu pakai, dan nggak nyangka hasilnya..."' },
  challenge:     { label: "Challenge/Garansi", example: '"Coba 7 hari, kalau nggak ada perubahan, aku minta maaf"' },
  before_after:  { label: "Before & After", example: '"Ini kondisi kulit aku sebelum vs sesudah pakai ini"' },
};

// ─── Extracted Product Data (hasil ekstrak AI dari URL) ─────────────────────
export interface ExtractedProduct {
  namaProduk: string;
  kategori: string;
  deskripsiProduk: string;
  masalahPainPoint: string;
  manfaatUtama: string;
  fiturKandungan: string;
  targetAudiens: string;
  harga?: string;
  imageUrl?: string;
  sourceUrl: string;
}

// ─── Request ke API generate ──────────────────────────────────────────────────
export interface UGCGenerateRequest {
  // Data produk (dari ekstrak atau manual)
  product: ExtractedProduct;
  // Konfigurasi output
  platform: UGCPlatform;
  durasi: string;
  gayaBahasa: UGCLanguageStyle;
  presenter: UGCPresenter;
  hookStyle: UGCHookStyle;
  language: "id" | "en";
  // Opsi lanjutan
  customInstructions?: string;
  brandVoice?: string;
}

// ─── Output dari AI ───────────────────────────────────────────────────────────
export interface UGCScene {
  durasi: string;       // misal "0-3 detik"
  aksi: string;         // apa yang dilakukan presenter
  dialog: string;       // teks yang diucapkan
  visualNote: string;   // catatan kamera/visual
}

export interface UGCPackage {
  hook: string;                 // kalimat pembuka paling menarik
  script: UGCScene[];           // breakdown per scene
  fullScript: string;           // script lengkap dalam satu teks
  caption: string;              // caption untuk posting
  hashtags: string[];           // hashtag relevan
  callToAction: string;         // CTA di akhir video
  tipsProduction: string[];     // tips produksi untuk kreator
  metadata: {
    generatedAt: string;
    model: string;
    platform: UGCPlatform;
    durasi: string;
    language: "id" | "en";
  };
}
