package org.springblade.common.upyzt.net;

import org.springblade.common.upyzt.Upyzt;
import lombok.Data;

@Data
public class RequestOptions {
    private final String rootMchId;
    private final String signPrivateKey;
    private final String verifyPublicKey;

    private final int connectTimeout;
    private final int readTimeout;

    private final int maxNetworkRetries;
    private final String acceptLanguage;

    public static RequestOptions getDefault() {
        return new RequestOptions(
                Upyzt.getRootMchId(),
                Upyzt.getSignPrivateKey(),
                Upyzt.getVerifyPublicKey(),
                Upyzt.getConnectTimeout(),
                Upyzt.getReadTimeout(),
                Upyzt.getMaxNetworkRetries(),
                Upyzt.getAcceptLanguage());
    }

    public RequestOptions(
            String rootMchId,
            String signPrivateKey,
            String verifyPublicKey) {
        this.rootMchId = rootMchId;
        this.signPrivateKey = signPrivateKey;
        this.verifyPublicKey = verifyPublicKey;
        this.connectTimeout = Upyzt.getConnectTimeout();
        this.readTimeout = Upyzt.getReadTimeout();
        this.maxNetworkRetries = Upyzt.getMaxNetworkRetries();
        this.acceptLanguage = Upyzt.getAcceptLanguage();
    }

    public RequestOptions(
            String rootMchId,
            String signPrivateKey,
            String verifyPublicKey,
            int connectTimeout,
            int readTimeout,
            int maxNetworkRetries,
            String acceptLanguage) {
        this.rootMchId = rootMchId;
        this.signPrivateKey = signPrivateKey;
        this.verifyPublicKey = verifyPublicKey;
        this.connectTimeout = connectTimeout;
        this.readTimeout = readTimeout;
        this.maxNetworkRetries = maxNetworkRetries;
        this.acceptLanguage = acceptLanguage;
    }
}
