import type {
  ClassroomSupportAgeFilter,
  ClassroomSupportCategoryFilter,
  ClassroomSupportZoneFilter,
} from '@/shared/constants/classroomSupport';
import type { Strategy } from '@/shared/types/app';

export interface ClassroomStrategyDraft {
  readonly id: string | null;
  readonly title: string;
  readonly description: string;
  readonly implementationTip: string;
  readonly category: Strategy['category'];
  readonly ageGroup: Strategy['ageGroup'];
  readonly zone: Strategy['zone'];
  readonly image: string;
}

export type ClassroomStrategyDraftMode = 'create' | 'edit';

export interface ClassroomSupportFilters {
  readonly searchQuery: string;
  readonly categoryFilter: ClassroomSupportCategoryFilter;
  readonly ageFilter: ClassroomSupportAgeFilter;
  readonly zoneFilter: ClassroomSupportZoneFilter;
  readonly showFavoritesOnly: boolean;
}

export interface ClassroomSupportPage {
  readonly strategies: readonly Strategy[];
  readonly filteredStrategies: readonly Strategy[];
  readonly favoriteStrategyIds: ReadonlySet<string>;
  readonly favoriteCount: number;
  readonly canPersistFavorites: boolean;
  readonly isSavingFavorite: boolean;
  readonly favoriteError: unknown;
  readonly canManageStrategies: boolean;
  readonly strategyDraft: ClassroomStrategyDraft | null;
  readonly strategyDraftMode: ClassroomStrategyDraftMode | null;
  readonly strategyDraftError: string | null;
  readonly strategySaveMessage: string | null;
  readonly isSavingStrategies: boolean;
  readonly strategyManagementError: unknown;
  readonly filters: ClassroomSupportFilters;
  readonly selectedStrategy: Strategy | null;
  readonly pendingDeleteStrategy: Strategy | null;
  readonly tryTodayStrategy: Strategy | null;
  readonly isLoading: boolean;
  readonly error: unknown;
  readonly setSearchQuery: (query: string) => void;
  readonly setCategoryFilter: (filter: ClassroomSupportCategoryFilter) => void;
  readonly setAgeFilter: (filter: ClassroomSupportAgeFilter) => void;
  readonly setZoneFilter: (filter: ClassroomSupportZoneFilter) => void;
  readonly toggleFavoritesOnly: () => void;
  readonly toggleFavorite: (id: string) => void;
  readonly selectStrategy: (strategy: Strategy) => void;
  readonly closeStrategy: () => void;
  readonly clearSearch: () => void;
  readonly startCreateStrategy: () => void;
  readonly startEditStrategy: (strategy: Strategy) => void;
  readonly updateStrategyDraft: (updates: Partial<ClassroomStrategyDraft>) => void;
  readonly cancelStrategyDraft: () => void;
  readonly saveStrategyDraft: () => void;
  readonly requestDeleteStrategy: (strategy: Strategy) => void;
  readonly cancelDeleteStrategy: () => void;
  readonly confirmDeleteStrategy: () => void;
}
