import { z } from "zod"

import { CurrencyEnum } from "@/types/enums/currency"

interface TPrice {
  additionalPrice?: number
  additionalPriceCurrency?: CurrencyEnum
  currency: CurrencyEnum
  price: number
  regularPrice?: number
}

export interface Price {
  requested?: TPrice
  local: TPrice
}

export const PointsPriceSchema = z
  .object({
    localPrice: z.object({
      currency: z.nativeEnum(CurrencyEnum),
      price: z.number(),
      additionalPrice: z.number().optional(),
      additionalPriceCurrency: z.nativeEnum(CurrencyEnum).optional(),
    }),
  })
  .transform((data) => ({
    local: {
      ...data.localPrice,
    },
  }))
