package com.haha.service.payment.impl;

import com.haha.common.enums.PaymentChannel;
import com.haha.service.payment.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 支付宝普通支付策略（骨架实现）
 * 
 * 通过配置 alipay.enabled=true 启用
 * 待真正接入支付宝 SDK 后完善具体实现
 */
@Slf4j
@Component
@ConditionalOnProperty(name = "alipay.enabled", havingValue = "true", matchIfMissing = false)
public class AliPayStrategy implements PaymentStrategy {
    
    @Override
    public PaymentChannel getChannel() {
        return PaymentChannel.ALIPAY;
    }
    
    @Override
    public PaymentResult createPayment(PaymentRequest request) {
        log.info("支付宝普通支付 - 创建支付请求: 订单号={}, 金额={}, 用户={}", 
            request.getOrderNo(), request.getAmount(), request.getUserId());
        throw new UnsupportedOperationException("支付宝普通支付暂未接入，请等待后续版本支持");
    }
    
    @Override
    public RefundResult refund(RefundRequest request) {
        log.info("支付宝普通支付 - 退款请求: 订单号={}, 退款金额={}", 
            request.getOrderNo(), request.getRefundAmount());
        throw new UnsupportedOperationException("支付宝退款暂未接入，请等待后续版本支持");
    }
    
    @Override
    public PaymentCallbackResult parseCallback(Map<String, Object> params) {
        log.info("支付宝普通支付 - 解析回调通知: {}", params);
        throw new UnsupportedOperationException("支付宝回调解析暂未接入");
    }
    
    @Override
    public boolean verifyCallback(Map<String, Object> params) {
        log.info("支付宝普通支付 - 验证回调签名");
        throw new UnsupportedOperationException("支付宝签名验证暂未接入");
    }
    
    @Override
    public PaymentResult queryPayment(String outTradeNo) {
        log.info("支付宝普通支付 - 查询支付状态: outTradeNo={}", outTradeNo);
        throw new UnsupportedOperationException("支付宝订单查询暂未接入");
    }
}
