package com.example.demo.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

/**
 * 支付配置类
 * 集成IJPay支付模块配置
 */
@Configuration
@PropertySource("classpath:payment.properties")
public class PaymentConfig {

    @Bean
    @ConfigurationProperties(prefix = "alipay")
    public AliPayConfig aliPayConfig() {
        return new AliPayConfig();
    }

    @Bean
    @ConfigurationProperties(prefix = "paypal")
    public PayPalConfig payPalConfig() {
        return new PayPalConfig();
    }

    /**
     * 支付宝配置
     */
    public static class AliPayConfig {
        private String appId;
        private String privateKey;
        private String publicKey;
        private String serverUrl;
        private String domain;
        private String appCertPath;
        private String aliPayCertPath;
        private String aliPayRootCertPath;

        // Getters and Setters
        public String getAppId() { return appId; }
        public void setAppId(String appId) { this.appId = appId; }
        
        public String getPrivateKey() { return privateKey; }
        public void setPrivateKey(String privateKey) { this.privateKey = privateKey; }
        
        public String getPublicKey() { return publicKey; }
        public void setPublicKey(String publicKey) { this.publicKey = publicKey; }
        
        public String getServerUrl() { return serverUrl; }
        public void setServerUrl(String serverUrl) { this.serverUrl = serverUrl; }
        
        public String getDomain() { return domain; }
        public void setDomain(String domain) { this.domain = domain; }
        
        public String getAppCertPath() { return appCertPath; }
        public void setAppCertPath(String appCertPath) { this.appCertPath = appCertPath; }
        
        public String getAliPayCertPath() { return aliPayCertPath; }
        public void setAliPayCertPath(String aliPayCertPath) { this.aliPayCertPath = aliPayCertPath; }
        
        public String getAliPayRootCertPath() { return aliPayRootCertPath; }
        public void setAliPayRootCertPath(String aliPayRootCertPath) { this.aliPayRootCertPath = aliPayRootCertPath; }
    }

    /**
     * PayPal支付配置
     */
    public static class PayPalConfig {
        private String clientId;
        private String clientSecret;
        private String mode;
        private String returnUrl;
        private String cancelUrl;
        private String domain;

        // Getters and Setters
        public String getClientId() { return clientId; }
        public void setClientId(String clientId) { this.clientId = clientId; }
        
        public String getClientSecret() { return clientSecret; }
        public void setClientSecret(String clientSecret) { this.clientSecret = clientSecret; }
        
        public String getMode() { return mode; }
        public void setMode(String mode) { this.mode = mode; }
        
        public String getReturnUrl() { return returnUrl; }
        public void setReturnUrl(String returnUrl) { this.returnUrl = returnUrl; }
        
        public String getCancelUrl() { return cancelUrl; }
        public void setCancelUrl(String cancelUrl) { this.cancelUrl = cancelUrl; }
        
        public String getDomain() { return domain; }
        public void setDomain(String domain) { this.domain = domain; }
    }
}
