/**
 * The home page's opportunity-carousel shapes and its breakpoints.
 *
 * Lifted out of `VolunteerCard.tsx`, which declared four response interfaces
 * before its first line of behaviour.
 */

import type { User } from "@/store/authStore";
export interface OpportunityImage {
  image: string;
}

export interface VolunteerOpportunityData {
  id: number;
  opportunity_images: OpportunityImage[];
  title_en: string;
  title_ar: string;
  start_date: string;
  end_date: string;
  start_time: string;
  end_time: string;
  from_age: number;
  to_age?: number;
  format?: string;
  format_display?: { value_en: string; value_ar: string };
  location_en?: string;
  location_ar?: string;
  registered_volunteers_count: number;
  participants_needed: number;
  interest_display?: Array<{ value_en: string; value_ar: string }>;
  created_by?: { id: number };
  opportunity_status?: string;
  action_state?: string;
  approval_status?: string;
  due_date: string;
  all_registered_user?: Array<{ id: number }>;
  is_supports_disabled?: boolean;
  is_urgent?: boolean;
  is_relief?: boolean;
  is_emergency?: boolean;
  is_public?: boolean;
  is_registered?: boolean;
  is_registration_open?: boolean;
  is_registration_closed?: boolean;
}

export interface LearnServeOpportunityData {
  id: number;
  opportunity_images: OpportunityImage[];
  title_en: string;
  title_ar: string;
  start_date: string;
  end_date: string;
  start_time: string;
  end_time: string;
  from_age: number;
  to_age?: number;
  format?: string;
  format_display?: { value_en: string; value_ar: string };
  learning_type_display?: { value_en: string; value_ar: string };
  registered_volunteers_count: number;
  participants_needed: number;
  interest_display?: Array<{ value_en: string; value_ar: string }>;
  created_by?: { id: number };
  opportunity_status?: string;
  action_state?: string;
  approval_status?: string;
  due_date: string;
  all_registered_user?: Array<{ id: number }>;
  is_supports_disabled?: boolean;
  is_urgent?: boolean;
  is_relief?: boolean;
  is_emergency?: boolean;
  is_public?: boolean;
  is_registered?: boolean;
  is_registration_open?: boolean;
  is_registration_closed?: boolean;
}

export interface AllOpportunitiesFiltersData {
  startDate: string;
  endDate: string;
  tags: string[];
  location: string;
  gender: string;
  age: [number | null, number | null];
  opportunity_nationality: string;
  type: string;
  isRelief: boolean;
  isUrgent: boolean;
  isSpecialNeed: boolean;
  isInPerson: boolean;
  isOnline: boolean;
  matchMyInterest: boolean;
  status: string;
  sortBy: string;
}

export interface VolunteerCardProps {
  isOpportunity?: boolean;
  isLearnServe?: boolean;
  /**
   * The signed-in user from `authStore`, for the creator / registration checks.
   *
   * `User | null` rather than `any`: only `id` and `user_type` are ever read off
   * it across the four card families, and both are declared on `User`. It was
   * `any` because the card types predate that interface, not because the shape
   * is unknown.
   */
  currentUser?: User | null;
  buttonText?: string;
  is_homepage?: boolean;
  filters?: AllOpportunitiesFiltersData;
  searchQuery?: string;
  /** Pre-fetched initial data from the server — avoids a client fetch on first paint */
  initialData?: Array<VolunteerOpportunityData | LearnServeOpportunityData>;
}

export { homeCarouselResponsive as responsive } from "./homeCarouselLayout";
