/**
 * Mock 워크스페이스 데이터 — RunSummary API에 부족한 필드(분석 대상 URL/핸들)
 * 가 추가되기 전까지 시각화용으로 사용합니다.
 *
 * 향후 백엔드 변경 시 `useClinicWorkspace.ts` 에서 이 mock 대신 실 데이터로 교체.
 */
import type { WorkspaceData } from '../types/workspace';

export const mockWorkspace: WorkspaceData = {
  clinic: {
    clinicId: 'view-clinic',
    name: '뷰성형외과의원',
    nameEn: 'VIEW Plastic Surgery',
    location: '서울 강남구 신사동',
    brandColor: '#4F1DA1',
    // mockClinicProfile.ts 의 CLINIC.websites/socialChannels 와 동일한 출처 — 두 페이지 핸들 일치 유지
    defaultTargets: [
      { platform: 'website', handle: 'viewclinic.com', url: 'https://viewclinic.com' },
      { platform: 'youtube', handle: 'youtube.com/@ViewclinicKR', url: 'https://youtube.com/@ViewclinicKR' },
      { platform: 'instagram', handle: 'instagram.com/viewplastic', url: 'https://instagram.com/viewplastic' },
      { platform: 'facebook', handle: 'facebook.com/viewps1', url: 'https://facebook.com/viewps1' },
      { platform: 'naverPlace', handle: 'place.naver.com/hospital/11709005', url: 'https://m.place.naver.com/hospital/11709005/home' },
      { platform: 'naverBlog', handle: 'blog.naver.com/viewclinicps', url: 'https://blog.naver.com/viewclinicps' },
      { platform: 'gangnamUnni', handle: 'gangnamunni.com/hospitals/189', url: 'https://www.gangnamunni.com/hospitals/189' },
    ],
  },
  runs: Array.from({ length: 10 }, (_, i) => {
    // 최신 → 과거 순 (2026-04 부터 매 ~12일 간격으로 거슬러 올라감)
    const baseDate = new Date('2026-04-22T09:11:00Z');
    baseDate.setDate(baseDate.getDate() - i * 12);
    const score = Math.max(45, 85 - i * 1.5);
    const targets = [
      { platform: 'website' as const, handle: 'viewclinic.com' },
      { platform: 'instagram' as const, handle: '@viewplastic' },
      ...(i % 3 !== 2 ? [{ platform: 'youtube' as const, handle: '@ViewclinicKR' }] : []),
      ...(i % 2 === 0 ? [{ platform: 'facebook' as const, handle: 'viewclinic' }] : []),
      { platform: 'gangnamUnni' as const, handle: 'gangnamunni.com/hospitals/189' },
      { platform: 'naverPlace' as const, handle: 'place.naver.com/hospital/11709005' },
    ];
    return {
      runId: `run-${baseDate.toISOString().slice(0, 10)}`,
      startedAt: baseDate.toISOString(),
      completedAt: new Date(baseDate.getTime() + 23 * 60 * 1000).toISOString(),
      status: 'completed' as const,
      overallScore: Math.round(score),
      targets,
    };
  }),
  plans: Array.from({ length: 10 }, (_, i) => {
    const baseDate = new Date('2026-04-22T09:11:00Z');
    baseDate.setDate(baseDate.getDate() - i * 12);
    const runId = `run-${baseDate.toISOString().slice(0, 10)}`;
    return {
      planId: `plan-${baseDate.toISOString().slice(0, 10)}`,
      baseRunId: runId,
      createdAt: new Date(baseDate.getTime() + 24 * 60 * 60 * 1000).toISOString(),
      status: (i === 0 ? 'active' : 'archived') as 'active' | 'archived',
      workflowProgress: i === 0 ? 42 : 100,
      channels: [
        { platform: 'instagram' as const, handle: '@viewplastic' },
        { platform: 'youtube' as const, handle: '@ViewclinicKR' },
      ],
    };
  }),
};
