export interface TimelineItem {
  key: string
  title: string
  startsAt: string
  endsAt: string
  state: 'done' | 'active' | 'upcoming'
}

export interface FeaturedCategory {
  id: number
  groupName: string
  name: string
  description: string
  maxNomineesPerUser: number
}

export interface WinnerPreview {
  year: number
  category: string
  winnerName: string
  winnerSlug: string
}

export interface FaqItem {
  question: string
  answer: string
}

export interface OverviewResponse {
  seasonId: number
  year: number
  title: string
  showDate: string
  currentPhase: string
  isCommunityOnly: boolean
  loginProvider: string
  timeline: TimelineItem[]
  featuredCategories: FeaturedCategory[]
  winnersPreview: WinnerPreview[]
  faq: FaqItem[]
}

export interface CandidateSummary {
  id: number
  displayName: string
  channelSlug: string
  platform: string
  /** Repräsentativer Clip/Video-Link, damit Votende vor der Wahl reinschauen können. */
  clipUrl?: string
}

export interface PublicCategoryDetail {
  id: number
  name: string
  groupName: string
  description: string
  maxNomineesPerUser: number
  candidates: CandidateSummary[]
}

export interface SeasonCategoriesResponse {
  seasonId: number
  year: number
  categories: PublicCategoryDetail[]
}

export interface WinnerArchiveItem {
  category: string
  winnerName: string
  winnerSlug: string
}

export interface WinnerArchiveResponse {
  year: number
  items: WinnerArchiveItem[]
}

export interface AdminMetric {
  label: string
  value: number
  note: string
}

export interface AdminActivity {
  label: string
  age: string
}

export interface AdminTopCategory {
  category: string
  votes: number
}

export interface AdminRiskFlag {
  id: number
  source: string
  type: string
  severity: string
  status: string
  summary: string
  twitchUserId: string | null
  createdFromIp: string
  createdAt: string
  metadataJson: string
}

export interface AdminAuditEntry {
  id: number
  adminTwitchUserId: string
  actionType: string
  entityType: string
  entityId: string
  summary: string
  createdAt: string
}

export interface AdminDashboardResponse {
  metrics: AdminMetric[]
  activities: AdminActivity[]
  topCategories: AdminTopCategory[]
  riskFlags: AdminRiskFlag[]
  auditEntries: AdminAuditEntry[]
}

export interface AdminSeasonListItem {
  id: number
  year: number
  name: string
  currentPhase: string
  isCurrent: boolean
  categoryCount: number
}

export interface AdminCategoryItem {
  id: number
  groupName: string
  name: string
  slug: string
  description: string
  sortOrder: number
  maxNomineesPerUser: number
  candidateCount: number
}

export interface AdminCandidateItem {
  id: number
  categoryId: number
  displayName: string
  channelSlug: string
  platform: string
}

export interface AdminNominationReviewItem {
  id: number
  categoryId: number
  categoryName: string
  submittedByTwitchId: string
  candidateText: string
  createdAt: string
}

export interface AdminClipSubmissionItem {
  id: number
  categoryId: number | null
  submittedByTwitchId: string
  clipUrl: string
  title: string
  creator: string
  platform: string
  status: string
  createdAt: string
}

export interface AdminSeasonDetailResponse {
  id: number
  year: number
  name: string
  currentPhase: string
  isCurrent: boolean
  categories: AdminCategoryItem[]
  candidates: AdminCandidateItem[]
  pendingNominations: AdminNominationReviewItem[]
  clipSubmissions: AdminClipSubmissionItem[]
}

export interface CreateNominationPayload {
  year: number
  categoryId: number
  twitchUserId: string
  nominees: string[]
}

export interface CreateClipPayload {
  year: number
  categoryId: number | null
  twitchUserId: string
  clipUrl: string
  title: string
  creator: string
}

export interface VoteEntryPayload {
  categoryId: number
  candidateId: number
}

export interface CreateVotePayload {
  seasonId: number
  twitchUserId: string
  entries: VoteEntryPayload[]
}

export interface UpdateSeasonPayload {
  currentPhase: string
  isCurrent: boolean
}

export interface UpsertCategoryPayload {
  groupName: string
  name: string
  slug: string
  description: string
  sortOrder: number
  maxNomineesPerUser: number
}

export interface UpsertCandidatePayload {
  categoryId: number
  displayName: string
  channelSlug: string
  platform: string
}

export interface ApproveNominationPayload {
  displayName: string
  channelSlug: string
  platform: string
}

export interface AuthSession {
  sessionToken: string
  twitchUserId: string
  displayName: string
  role: 'viewer' | 'admin'
}

export interface LoginPayload {
  twitchUserId: string
  displayName: string
  role: 'viewer' | 'admin'
}
