import { z } from 'zod';

// 支付创建请求Schema - 多租户版本
export const PaymentCreateRequestSchema = z.object({
  orderId: z.number().int().positive(),
  totalAmount: z.number().int().positive(),
  description: z.string().min(1).max(128)
});

export type PaymentCreateRequest = z.infer<typeof PaymentCreateRequestSchema>;

// 支付创建响应Schema - 多租户版本
export const PaymentCreateResponseSchema = z.object({
  paymentId: z.string(),
  timeStamp: z.string(),
  nonceStr: z.string(),
  package: z.string(),
  signType: z.string(),
  paySign: z.string(),
  totalAmount: z.number()
});

export type PaymentCreateResponse = z.infer<typeof PaymentCreateResponseSchema>;

// 支付状态查询响应Schema - 多租户版本
export const PaymentStatusResponseSchema = z.object({
  paymentStatus: z.enum(['待支付', '支付中', '已支付', '支付失败', '已退款', '已关闭'])
});

export type PaymentStatusResponse = z.infer<typeof PaymentStatusResponseSchema>;

// 支付回调请求Schema - 多租户版本
export const PaymentCallbackRequestSchema = z.object({
  id: z.string(),
  create_time: z.string(),
  event_type: z.string(),
  resource_type: z.string(),
  resource: z.object({
    algorithm: z.string(),
    ciphertext: z.string(),
    associated_data: z.string().optional(),
    nonce: z.string()
  }),
  summary: z.string()
});

export type PaymentCallbackRequest = z.infer<typeof PaymentCallbackRequestSchema>;