package com.ruoyi.logistics.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties(prefix = "sf.express")
public class SFExpressConfig {

    /**
     * 客户编码
     */
    private String clientCode;

    /**
     * 校验码
     */
    private String checkWord;

    /**
     * 月结吗（顺丰月结吗账号）
     */
    private String monthlyCord;
    /**
     * 沙箱环境API地址
     */
    private String sandboxUrl;

    /**
     * 生产环境API地址
     */
    private String productionUrl;

    private Environment environment;



    // 环境枚举
    public enum Environment {
        SANDBOX, PRODUCTION
    }

    // Getters and Setters
    public String getClientCode() {
        return clientCode;
    }

    public void setClientCode(String clientCode) {
        this.clientCode = clientCode;
    }

    public String getCheckWord() {
        return checkWord;
    }

    public void setCheckWord(String checkWord) {
        this.checkWord = checkWord;
    }

    public String getSandboxUrl() {
        return sandboxUrl;
    }

    public void setSandboxUrl(String sandboxUrl) {
        this.sandboxUrl = sandboxUrl;
    }

    public String getProductionUrl() {
        return productionUrl;
    }

    public void setProductionUrl(String productionUrl) {
        this.productionUrl = productionUrl;
    }

    public Environment getEnvironment() {
        return environment;
    }

    public void setEnvironment(Environment environment) {
        this.environment = environment;
    }

    public void setMonthlyCord(String monthlyCord) {
        this.monthlyCord = monthlyCord;
    }

    public String getMonthlyCord() {
        return monthlyCord;
    }

    /**
     * 获取当前环境的API地址
     */
    public String getCurrentApiUrl() {
        return environment == Environment.SANDBOX ? sandboxUrl : productionUrl;
    }
}

