import { z } from 'zod'

export const chargeSchema = z.object({
  provider:   z.enum(['AMANPAY', 'PAYPAL']),
  type:       z.enum(['CHARGE', 'DEPOSIT']).default('CHARGE'),
  currency:   z.literal('MAD').default('MAD'),
  successUrl: z.string().url(),
  failureUrl: z.string().url(),
})

export const manualPaymentSchema = z.object({
  amount:        z.number().int().positive(),
  currency:      z.literal('MAD').default('MAD'),
  type:          z.enum(['CHARGE', 'DEPOSIT']).default('CHARGE'),
  paymentMethod: z.enum(['CASH', 'CHECK', 'BANK_TRANSFER', 'CARD', 'PAYPAL']),
})

export const refundSchema = z.object({
  amount: z.number().int().positive().optional(),
  reason: z.string().optional(),
})

export const capturePaypalSchema = z.object({
  paypalOrderId: z.string(),
})

export const reservationParamSchema = z.object({
  id: z.string().min(1),
})

export const paymentParamSchema = z.object({
  reservationId: z.string().min(1),
  paymentId:     z.string().min(1),
})
