{
  "schema_version": "1.0",
  "baseline": "V4",
  "updated_at": "2026-04-22",
  "owner_session": "B",
  "phase": "Phase 12E — Case Issues Portal Management",
  "purpose": "B-owned contract for the Case Issues Portal — creation · intake · pattern extraction · daily possible-case generation · views · exports · languages. A-owned runtime implements the pipeline + persistence + API.",
  "hard_rules": [
    "AI-created cases always enter at T5 · requires_human_review=true · dual approval if sensitive_surface_flag=true",
    "No case is auto-closed by AI · only humans close",
    "Trilingual TH+EN+ZH for user-visible surfaces · internal ids English",
    "PDPA discipline per case_schema.json",
    "Daily possible-case generation MUST declare ai_provenance + confidence + never auto-escalate"
  ],
  "creation_modes": [
    {
      "id":"mode-manual",
      "label_th":"สร้างด้วยมือ","label_en":"Manual create","label_zh":"手动创建",
      "description_th":"ผู้ใช้กรอกฟอร์ม","description_en":"User fills the form","description_zh":"用户填写表单",
      "ai_assisted": false,
      "default_status":"st-new"
    },
    {
      "id":"mode-ai-from-text",
      "label_th":"AI สร้างจากข้อความ","label_en":"AI create from text","label_zh":"AI 从文本创建",
      "description_th":"ผู้ใช้วางข้อความ (review · complaint · memo) · AI สกัด attributes + pattern + เสนอ issue_definition",
      "description_en":"User pastes text (review · complaint · memo) · AI extracts attributes + pattern + proposes issue_definition",
      "description_zh":"用户粘贴文本（评价 · 投诉 · 备忘录） · AI 提取属性 + 模式 + 建议问题定义",
      "ai_assisted": true,
      "default_status":"st-new",
      "requires_human_review": true,
      "honest_note":"All AI suggestions must be accepted by a human before the case leaves st-new"
    },
    {
      "id":"mode-ai-from-image",
      "label_th":"AI สร้างจากภาพ","label_en":"AI create from image","label_zh":"AI 从图像创建",
      "description_th":"OCR + vision · สกัดข้อความ + สถานที่ + วัตถุ · propose case draft","description_en":"OCR + vision · extract text + location + object · propose case draft","description_zh":"OCR + 视觉 · 提取文字 + 位置 + 对象 · 生成案例草稿",
      "ai_assisted": true,
      "default_status":"st-new",
      "requires_human_review": true
    },
    {
      "id":"mode-ai-from-pdf",
      "label_th":"AI สร้างจาก PDF","label_en":"AI create from PDF","label_zh":"AI 从 PDF 创建",
      "description_th":"PDF parse (report · memo · policy) · สกัด attributes + chunks","description_en":"PDF parse (report · memo · policy) · extract attributes + chunks","description_zh":"PDF 解析（报告 · 备忘 · 政策） · 提取属性 + 片段",
      "ai_assisted": true,
      "default_status":"st-new",
      "requires_human_review": true
    },
    {
      "id":"mode-ai-from-link",
      "label_th":"AI สร้างจากลิงก์","label_en":"AI create from link","label_zh":"AI 从链接创建",
      "description_th":"fetch URL (article · post · page) · scrape + summarise · propose draft","description_en":"Fetch URL (article · post · page) · scrape + summarise · propose draft","description_zh":"获取 URL（文章 · 帖子 · 页面） · 抓取 + 总结 · 生成草稿",
      "ai_assisted": true,
      "default_status":"st-new",
      "requires_human_review": true
    },
    {
      "id":"mode-ai-from-social",
      "label_th":"AI สร้างจาก social monitoring","label_en":"AI create from social monitoring","label_zh":"AI 从社交监控创建",
      "description_th":"social listening feed · sentiment pipeline กระตุ้น case draft · เฉพาะกรณีขัดเกณฑ์ threshold","description_en":"Social listening feed · sentiment pipeline triggers case draft · only when threshold breached","description_zh":"社交监听信息源 · 情感管道触发案例草稿 · 仅在阈值突破时",
      "ai_assisted": true,
      "default_status":"st-new",
      "requires_human_review": true,
      "sensitive_note":"Social media PII must never be stored · only aggregates + hashed handle + permalink"
    }
  ],
  "pattern_extraction": {
    "description_th":"AI วิเคราะห์ข้อความ · สกัด 'pattern ของปัญหา' (เช่น 'night-bus delay + beach-road · 22:00–02:00')","description_en":"AI analyses text · extracts 'issue pattern' (e.g. 'night-bus delay + beach-road · 22:00–02:00')","description_zh":"AI 分析文本 · 提取'问题模式'（例如 '夜班车延误 + 海滩路 · 22:00–02:00'）",
    "outputs":["pattern_id","pattern_signature","confidence","similar_past_cases"],
    "requires_human_review": true
  },
  "attribute_extraction": {
    "description_th":"AI สกัด attributes: zone · persona · severity hint · spend tier · time window","description_en":"AI extracts attributes: zone · persona · severity hint · spend tier · time window","description_zh":"AI 提取属性：区域 · 人物画像 · 严重度提示 · 消费等级 · 时段",
    "outputs":["attribute_map","confidence_per_attribute"],
    "requires_human_review": true
  },
  "daily_possible_case_generation": {
    "description_th":"ทุกเช้า 07:00 Asia/Bangkok · AI อ่าน overnight signal + social · สร้าง 'possible case' queue · ไม่ใช่ case จริง · เจ้าหน้าที่รีวิวก่อนเปิด","description_en":"Every morning 07:00 Asia/Bangkok · AI reads overnight signals + social · creates a 'possible case' queue · not a real case · staff reviews before opening","description_zh":"每天早上 07:00 Asia/Bangkok · AI 读取过夜信号 + 社交 · 生成'可能案例'队列 · 非真实案例 · 员工审核后开启",
    "queue_name":"possible_case_daily_queue",
    "default_status":"st-new + requires_human_review=true",
    "max_items_per_day": 20,
    "sla":"review within 4h",
    "requires_human_review": true
  },
  "view_modes": [
    {"id":"view-overview","label_th":"ภาพรวม","label_en":"Overview","label_zh":"总览","layout":"stat-strip + recent · top severity · open counts"},
    {"id":"view-search","label_th":"ค้นหา/กรอง","label_en":"Search/filter","label_zh":"搜索/筛选","layout":"search bar + chips + results list"},
    {"id":"view-map","label_th":"แผนที่","label_en":"Map view","label_zh":"地图视图","layout":"map + cluster pins + click → case detail"},
    {"id":"view-table","label_th":"ตาราง","label_en":"Table","label_zh":"表格","layout":"sortable table · all fields visible"},
    {"id":"view-dashboard","label_th":"แดชบอร์ด","label_en":"Dashboard","label_zh":"仪表板","layout":"per-case-type dashboards · unlimited user-defined"},
    {"id":"view-report","label_th":"รายงาน","label_en":"Report","label_zh":"报告","layout":"PDF-ready report layout · weekly/monthly rollup"},
    {"id":"view-detail","label_th":"รายละเอียด case","label_en":"Case detail","label_zh":"案例详情","layout":"full field set + AI analysis panel + lifecycle timeline + attachments"}
  ],
  "export_formats": [
    {"format":"CSV","scope":"current view + filters","a_owned_runtime":true},
    {"format":"JSON","scope":"full case records + attachments metadata","a_owned_runtime":true},
    {"format":"PDF","scope":"report view · snapshot model rendering","a_owned_runtime":true},
    {"format":"API","scope":"authenticated endpoint · OpenAPI spec to be authored in 12F","a_owned_runtime":true}
  ],
  "unlimited_case_dashboards": {
    "description_th":"ผู้ใช้สามารถสร้าง dashboard ของตัวเองสำหรับกลุ่ม case ได้ไม่จำกัด · save preset · share preset · ทุก preset เคารพ case_schema","description_en":"Users can create unlimited personal dashboards for case subsets · save preset · share preset · every preset respects case_schema","description_zh":"用户可创建无限个案例子集的个人仪表板 · 保存预设 · 分享预设 · 所有预设遵守 case_schema",
    "preset_storage":"B-owned contract · A-owned auth + storage"
  },
  "languages": {
    "supported":["th","en","zh"],
    "default":"th",
    "auto_translate_policy":"If a case has only 2 of 3 languages on user-visible fields · AI auto-translates to the third · flagged requires_human_review=true · not merged until human approves"
  },
  "phase_linkage": {
    "12F_sub1_navigator":"AI-created cases appear in SUB-1 review queue alongside other Claude-authored artefacts",
    "12F_sub2_wizard":"Premium subscribers can create personal case dashboards inside the wizard onboarding",
    "12F_sub3_enterprise":"Enterprise tenants inherit the portal · custom case_types + thresholds allowed per tenant",
    "12F_sub4_intake":"External tenant case imports use multi-source intake engine rules (SUB-4)"
  }
}
