<script setup lang="ts">
import HomeAccountAndPrivacyModals from './HomeAccountAndPrivacyModals.vue'
import HomeArchiveModal from './HomeArchiveModal.vue'
import HomeInteractionModal from './HomeInteractionModal.vue'
import type {
  HomeArchiveYearItem,
  HomeCategoryListItem,
  HomeNomineeListItem,
  HomeSelectedArchive,
  HomeSelectionOption,
} from './homeModalTypes'
import type { HomeNominationSubmitContext } from './homeLandingTypes'
import type { AuthSession } from '../../types/awards'

defineProps<{
  modalOpen: boolean
  submitted: boolean
  notSubmitted: boolean
  formError: string
  successTitle: string
  successText: string
  closeModal: () => void
  stop: (event: Event) => void
  isShow: boolean
  isPicker: boolean
  isVote: boolean
  isClip: boolean
  nominationPhase: boolean
  publicStreamUrl: string
  formatShowDate: () => string
  submitReminder: () => void
  pickerTitle: string
  pickerSubtitle: string
  catList: HomeCategoryListItem[]
  activeCatIndex: number
  activeCatName: string
  noms: HomeNomineeListItem[]
  voteCount: number
  totalCats: number
  canSubmitVote: boolean
  savedVoteActive: boolean
  submitVote: () => Promise<void> | void
  submitNomination: (context: HomeNominationSubmitContext) => Promise<void> | void
  submitting: boolean
  onClipCatChange: (event: Event) => void
  catOptions: HomeSelectionOption[]
  clipNomOptions: HomeSelectionOption[]
  clipDsgvo: boolean
  clipDsgvoChange: () => void
  onOpenPrivacy: () => void
  canSubmitClip: boolean
  clipSubmitStyle: string
  submitClip: () => Promise<void> | void
  archiveModalOpen: boolean
  archiveYears: HomeArchiveYearItem[]
  selectedArchive: HomeSelectedArchive
  onCloseArchive: () => void
  archiveModalStop: (event: Event) => void
  setArchiveYear: (year: number) => Promise<void>
  archiveYearButtonStyle: (active: boolean) => string
  winnerPlatformStyle: (url: string) => string
  winnerPlatformLabel: (url: string) => string
  privacyModalOpen: boolean
  privacyContentHtml: string
  onClosePrivacy: () => void
  privacyModalStop: (event: Event) => void
  accountModalOpen: boolean
  session: AuthSession | null
  twitchUser: string
  role: string
  deleteNotConfirm: boolean
  deleteConfirm: boolean
  accountActionError: string
  authLoading: boolean
  onCloseAccount: () => void
  accountModalStop: (event: Event) => void
  onLogout: () => Promise<void> | void
  onRequestDelete: () => void
  onCancelDelete: () => void
  onConfirmDelete: () => Promise<void> | void
}>()
</script>

<template>
  <HomeInteractionModal
    :modal-open="modalOpen"
    :submitted="submitted"
    :not-submitted="notSubmitted"
    :form-error="formError"
    :success-title="successTitle"
    :success-text="successText"
    :close-modal="closeModal"
    :stop="stop"
    :is-show="isShow"
    :is-picker="isPicker"
    :is-vote="isVote"
    :is-clip="isClip"
    :nomination-phase="nominationPhase"
    :public-stream-url="publicStreamUrl"
    :format-show-date="formatShowDate"
    :submit-reminder="submitReminder"
    :picker-title="pickerTitle"
    :picker-subtitle="pickerSubtitle"
    :cat-list="catList"
    :active-cat-index="activeCatIndex"
    :active-cat-name="activeCatName"
    :noms="noms"
    :vote-count="voteCount"
    :total-cats="totalCats"
    :can-submit-vote="canSubmitVote"
    :saved-vote-active="savedVoteActive"
    :submit-vote="submitVote"
    :submit-nomination="submitNomination"
    :submitting="submitting"
    :on-clip-cat-change="onClipCatChange"
    :cat-options="catOptions"
    :clip-nom-options="clipNomOptions"
    :clip-dsgvo="clipDsgvo"
    :clip-dsgvo-change="clipDsgvoChange"
    :on-open-privacy="onOpenPrivacy"
    :can-submit-clip="canSubmitClip"
    :clip-submit-style="clipSubmitStyle"
    :submit-clip="submitClip"
  />

  <HomeArchiveModal
    :archive-modal-open="archiveModalOpen"
    :archive-years="archiveYears"
    :selected-archive="selectedArchive"
    :on-close-archive="onCloseArchive"
    :archive-modal-stop="archiveModalStop"
    :set-archive-year="setArchiveYear"
    :archive-year-button-style="archiveYearButtonStyle"
    :winner-platform-style="winnerPlatformStyle"
    :winner-platform-label="winnerPlatformLabel"
  />

  <HomeAccountAndPrivacyModals
    :privacy-modal-open="privacyModalOpen"
    :privacy-content-html="privacyContentHtml"
    :on-close-privacy="onClosePrivacy"
    :privacy-modal-stop="privacyModalStop"
    :account-modal-open="accountModalOpen"
    :session="session"
    :twitch-user="twitchUser"
    :role="role"
    :delete-not-confirm="deleteNotConfirm"
    :delete-confirm="deleteConfirm"
    :account-action-error="accountActionError"
    :auth-loading="authLoading"
    :on-close-account="onCloseAccount"
    :account-modal-stop="accountModalStop"
    :on-open-privacy="onOpenPrivacy"
    :on-logout="onLogout"
    :on-request-delete="onRequestDelete"
    :on-cancel-delete="onCancelDelete"
    :on-confirm-delete="onConfirmDelete"
  />
</template>
