import { CreationGalleryImage } from './Creation';

export interface EventPersonField {
  szemely: {
    name: string;
    mmaID: string;
    alkotoAzonosito: string;
    szakma: {
      name: string;
      id: number;
    };
    id: number;
  };
  kapcsolatTipusa: {
    nev: string | null;
    id: number | null;
  };
  megjegyzes: string | null;
  id: number;
}

type CulturalType = {
  id: number;
  nev: string;
};

export interface InstitutionAddress {
  mmaID: string | null;
  letrehozta: string | null;
  utoljaraSzerkesztette: string | null;
  address1: string | null;
  address1En: string | null;
  address2: string | null;
  address2En: string | null;
  city: string | null;
  cityEn: string | null;
  county: string | null;
  countyEn: string | null;
  zip: string | null;
  country: string | null;
  countryEn: string | null;
  countryCode: string | null;
  koordinatak: string | null;
  koordinatakPontossaga: string | null;
  id: number;
}

export interface Institution {
  nev: string | null;
  rovidites: string | null;
  intezmenyCime: InstitutionAddress;
  id: number;
}

export interface OrganizationalUnit {
  nevTr: string | null;
  egyseg1: string | null;
  egyseg2: string | null;
  egyseg3: string | null;
  egyseg1En: string | null;
  egyseg2En: string | null;
  egyseg3En: string | null;
  datumTol: string | null;
  datumTolTipus: string | null;
  datumIg: string | null;
  datumIgTipus: string | null;
  megjegyzes: string | null;
  cim: InstitutionAddress | null;
  letrehozta: string | null;
  utoljaraSzerkesztette: number | null;
  id: number;
}

export interface EventInstitutionField {
  intezmeny: Institution;
  szervezetiEgyseg: OrganizationalUnit | null;
  kapcsolatTipusa: {
    nev: string | null;
    id: number | null;
  };
  megjegyzes: string | null;
  helyszin: string | null;
  id: number;
}

export interface Event {
  kezdete: string; // ISO date string
  kezdeteDatum: boolean;
  vege: string | null; // ISO date string or null
  vegeDatum: boolean;
  nev: string;
  leiras: string | null; // HTML content
  infoUrl: string | null;
  jegyUrl: string | null;
  szemely: EventPersonField[];
  kepLink: string | null;
  kulturalisTipus: CulturalType[] | null;
  kulturalisAltipus: CulturalType[] | null;
  esemenyMMATagozat: { id: number; nev: string }[] | null;
  esemenyFoTipusa: { id: number; nev: string }[] | null;
  // esemenyKategoria: string | null; TODO
  id: number;
  intezmeny: EventInstitutionField[];
  category: string;
  bgColor: string; // manually added classname by FE
  color: string; // manually added classname by FE
  esemenyKategoria?: { id: number; nev: string }[] | null;
  url: string | null;
  fokep: CreationGalleryImage | null;
}

export interface EventListRequestBody {
  fromDate: string; // "20250101"
  toDate: string; // "20250723"
  personId: string | null; // "AL0000018"
  showMultiday: boolean;
}

export type EventListResponse = Event[];

export interface EventSubmitRequestForm {
  kezdete: string | null; // ISO date string
  vege: string | null; // ISO date string
  nev: string | null;
  leiras: string | null;
  infoUrl: string | null;
  jegyUrl: string | null;
  szemelyek: number[] | null;
  kulturalisTipus: number | null;
  kulturalisAltipus: number | null;
  helyszin: string | null;
  intezmeny: number | null;
  megjegyzes: string | null;
  egyebSzemelyek: string | null;
  esemenyKategoria: number | null;
  kepek?: string[] | null;
}
