import type { BrandInconsistency } from '@/features/report/types/report';

// ─── 섹션 1: 브랜딩 가이드 ───

export interface ColorSwatch {
  name: string;
  hex: string;
  usage: string;
}

export interface FontSpec {
  family: string;
  weight: string;
  usage: string;
  sampleText: string;
}

export interface LogoUsageRule {
  rule: string;
  description: string;
  correct: boolean;
}

export interface ToneOfVoice {
  personality: string[];
  communicationStyle: string;
  doExamples: string[];
  dontExamples: string[];
}

export interface ChannelBrandingRule {
  channel: string;
  icon: string;
  profilePhoto: string;
  bannerSpec: string;
  bioTemplate: string;
  currentStatus: 'correct' | 'incorrect' | 'missing';
}

export interface BrandGuide {
  colors: ColorSwatch[];
  fonts: FontSpec[];
  logoRules: LogoUsageRule[];
  toneOfVoice: ToneOfVoice;
  channelBranding: ChannelBrandingRule[];
  brandInconsistencies: BrandInconsistency[];
}

// ─── 섹션 2: 채널 커뮤니케이션 전략 ───

export interface ChannelStrategyCard {
  channelId: string;
  channelName: string;
  icon: string;
  currentStatus: string;
  targetGoal: string;
  contentTypes: string[];
  postingFrequency: string;
  tone: string;
  formatGuidelines: string[];
  priority: 'P0' | 'P1' | 'P2';
  customerJourneyStage?: 'awareness' | 'interest' | 'consideration' | 'conversion' | 'loyalty';
}

// ─── 섹션 3: 콘텐츠 마케팅 전략 ───

export interface ContentPillar {
  title: string;
  description: string;
  relatedUsp: string;
  exampleTopics: string[];
  color: string;
}

export interface ContentTypeRow {
  format: string;
  channels: string[];
  frequency: string;
  purpose: string;
}

export interface WorkflowStep {
  step: number;
  name: string;
  description: string;
  owner: string;
  duration: string;
}

export interface RepurposingOutput {
  format: string;
  channel: string;
  description: string;
}

export interface ContentStrategyData {
  pillars: ContentPillar[];
  typeMatrix: ContentTypeRow[];
  workflow: WorkflowStep[];
  repurposingSource: string;
  repurposingOutputs: RepurposingOutput[];
}

// ─── 섹션 4: 콘텐츠 캘린더 ───

export type ContentCategory = 'video' | 'blog' | 'social' | 'ad';

export interface CalendarEntry {
  dayOfWeek: number;
  channel: string;
  channelIcon: string;
  contentType: ContentCategory;
  title: string;
  // AI 생성 필드 (선택 — 결정론적 엔진과 하위 호환)
  id?: string;
  description?: string;
  pillar?: string;
  status?: 'draft' | 'approved' | 'published';
  isManualEdit?: boolean;
  aiPromptSeed?: string;
}

export interface CalendarWeek {
  weekNumber: number;
  label: string;
  entries: CalendarEntry[];
}

export interface ContentCountSummary {
  type: ContentCategory;
  label: string;
  count: number;
  color: string;
}

export interface CalendarData {
  weeks: CalendarWeek[];
  monthlySummary: ContentCountSummary[];
}

// ─── 섹션 5: 에셋 수집 ───

export type AssetSource = 'homepage' | 'naver_place' | 'blog' | 'social' | 'youtube';
export type AssetType = 'photo' | 'video' | 'text';
export type AssetStatus = 'collected' | 'pending' | 'needs_creation';

export interface AssetCard {
  id: string;
  source: AssetSource;
  sourceLabel: string;
  type: AssetType;
  title: string;
  description: string;
  repurposingSuggestions: string[];
  status: AssetStatus;
}

export interface YouTubeRepurposeItem {
  title: string;
  views: number;
  type: 'Short' | 'Long';
  repurposeAs: string[];
}

export interface AssetCollectionData {
  assets: AssetCard[];
  youtubeRepurpose: YouTubeRepurposeItem[];
}

// ─── 섹션 6: 리퍼포징 제안 ───

export interface RepurposingProposalItem {
  sourceVideo: YouTubeRepurposeItem;
  outputs: RepurposingOutput[];
  estimatedEffort: 'low' | 'medium' | 'high';
  priority: 'high' | 'medium' | 'low';
}

// ─── 섹션 7: 워크플로우 트래커 ───

export type WorkflowStage = 'planning' | 'ai-draft' | 'review' | 'approved' | 'scheduled';
export type WorkflowContentType = 'video' | 'image-text';

export interface WorkflowVideoDraft {
  script: string;
  shootingGuide: string[];
  duration: string; // 예: '60초', '15분'
}

export interface WorkflowImageTextDraft {
  type: 'cardnews' | 'blog';
  headline: string;
  copy: string[];
  layoutHint?: string;
}

export interface WorkflowItem {
  id: string;
  title: string;
  contentType: WorkflowContentType;
  channel: string;
  channelIcon: string;
  stage: WorkflowStage;
  userNotes?: string; // 사람이 입력한 수정 사항
  videoDraft?: WorkflowVideoDraft;
  imageTextDraft?: WorkflowImageTextDraft;
  scheduledDate?: string;
}

export interface WorkflowData {
  items: WorkflowItem[];
}

// ─── 루트 플랜 타입 ───

export interface MarketingPlan {
  id: string;
  reportId: string;
  clinicName: string;
  clinicNameEn: string;
  createdAt: string;
  targetUrl: string;
  brandGuide: BrandGuide;
  channelStrategies: ChannelStrategyCard[];
  contentStrategy: ContentStrategyData;
  calendar: CalendarData;
  assetCollection: AssetCollectionData;
  repurposingProposals?: RepurposingProposalItem[];
  workflow?: WorkflowData;
}
