import type { z } from "zod"

import type {
  BenefitReward,
  CouponData,
  CouponReward,
  REDEEM_LOCATIONS,
  REWARD_TYPES,
  rewardRefsSchema,
  validateCmsRewardsSchema,
} from "@/server/routers/contentstack/reward/output"

export type {
  ApiReward,
  BenefitReward,
  CMSReward,
  CMSRewardsResponse,
  Coupon,
  CouponReward,
  GetRewardRefsSchema,
  RedeemableCoupon,
  RedeemLocation,
  RewardType,
  SurpriseReward,
}

type CMSRewardsResponse = z.input<typeof validateCmsRewardsSchema>
type CMSReward = z.output<typeof validateCmsRewardsSchema>[number]

type GetRewardRefsSchema = z.input<typeof rewardRefsSchema>

type RedeemLocation = (typeof REDEEM_LOCATIONS)[number]

type RewardType = (typeof REWARD_TYPES)[keyof typeof REWARD_TYPES]

type Coupon = z.output<typeof CouponData>
type RedeemableCoupon = Coupon & {
  state: Exclude<Coupon["state"], "redeemed">
}

type BenefitReward = z.output<typeof BenefitReward>

type CouponReward = z.output<typeof CouponReward>
type SurpriseReward = CouponReward & {
  rewardType: "Surprise"
}

type ApiReward = BenefitReward | CouponReward
