import {
  WalkthroughCheckinDto,
  WalkthroughRatingKey,
} from '@/shared/types/walkthrough';
import type { WalkthroughCheckinCreateDto } from '@/shared/types/walkthrough';

export type WalkthroughCheckinViewModel = WalkthroughCheckinDto;

export interface WalkthroughCategoryAverage {
  readonly key: WalkthroughRatingKey;
  readonly label: string;
  readonly avg: number;
  readonly max: number;
  readonly count: number;
}

export interface WalkthroughTrendPoint {
  readonly date: string;
  readonly pct: number;
  readonly teacher: string;
}

export interface WalkthroughAttentionFlag {
  readonly teacher: string;
  readonly category: string;
  readonly count: number;
}

export interface WalkthroughRecognition {
  readonly teacher: string;
  readonly category: string;
}

export interface WalkthroughGrowthPlan {
  readonly strengths: string;
  readonly focusAreas: string;
  readonly nextSteps: string;
  readonly reviewDate: string;
}

export interface WalkthroughTeacherFrequency {
  readonly teacher: string;
  readonly count: number;
  readonly pct: number;
}

export type WalkthroughCheckInTabId = 'new' | 'summary' | 'history';

export type WalkthroughCheckInStatTone = 'indigo' | 'violet' | 'cyan' | 'emerald';

export interface WalkthroughCheckInTab {
  readonly id: WalkthroughCheckInTabId;
  readonly label: string;
}

export interface WalkthroughCheckInStat {
  readonly id: string;
  readonly label: string;
  readonly value: string;
  readonly tone: WalkthroughCheckInStatTone;
}

export type WalkthroughHistoryTone = 'strong' | 'developing' | 'priority';

export interface WalkthroughHistoryCategory {
  readonly key: WalkthroughRatingKey;
  readonly label: string;
  readonly value: number;
  readonly max: number;
  readonly tone: WalkthroughHistoryTone;
}

export interface WalkthroughHistoryRow {
  readonly id: string;
  readonly teacherName: string;
  readonly classroom: string;
  readonly date: string;
  readonly timeLabel: string;
  readonly overallPct: number;
  readonly tone: WalkthroughHistoryTone;
  readonly categories: readonly WalkthroughHistoryCategory[];
  readonly notes: string | null;
}

export interface WalkthroughCheckInPage {
  readonly activeTab: WalkthroughCheckInTabId;
  readonly tabs: readonly WalkthroughCheckInTab[];
  readonly checkins: readonly WalkthroughCheckinDto[];
  readonly stats: readonly WalkthroughCheckInStat[];
  readonly historyRows: readonly WalkthroughHistoryRow[];
  readonly loading: boolean;
  readonly submitting: boolean;
  readonly errorMessage: string | null;
  readonly userName: string;
  readonly setActiveTab: (tab: WalkthroughCheckInTabId) => void;
  readonly refresh: () => Promise<void>;
  readonly submit: (data: WalkthroughCheckinCreateDto) => Promise<void>;
}
