import type { Dispatch, SetStateAction } from "react"
import type { z } from "zod"

import type { DynamicContent } from "@/types/trpc/routers/contentstack/blocks"
import type { blocksSchema } from "@/server/routers/contentstack/accountPage/output"
import type { Reward } from "../rewards"

export interface AccountPageContentProps
  extends Pick<DynamicContent, "dynamic_content"> {}

export interface AccountPageComponentProps {
  title: string | null
  subtitle: string | null
  link?: { href: string; text: string }
}

type Content = z.output<typeof blocksSchema>

export type ContentProps = {
  content: Content[]
}

export interface CurrentRewardsClientProps {
  rewards: Reward[]
  showRedeem: boolean
  membershipNumber?: string | null
}

export interface RedeemProps {
  reward: Reward
  membershipNumber?: string | null
}

export interface ScriptedRewardTextProps {
  reward: Reward
}

export type RedeemModalState = "unmounted" | "hidden" | "visible"

export type RedeemStep =
  | "initial"
  | "confirmation"
  | "redeemed"
  | "confirm-close"

export type RedeemFlowContext = {
  redeemStep: RedeemStep
  setRedeemStep: Dispatch<SetStateAction<RedeemStep>>
  defaultTimeRemaining: number
  timeRemaining: number
  setTimeRemaining: Dispatch<SetStateAction<number>>
}
