package com.jeequan.jeepay.thirdparty.channel.lklsb2bpay.model;

import com.jeequan.jeepay.thirdparty.channel.lklpay.utils.LklpayConst;
import lombok.Getter;
import org.springframework.http.MediaType;

@Getter
public abstract class ILklTkReqMethod {

    protected ILklTkReqMethod(String url, String templateWord, String method, String urlFlag) {
        this(url, templateWord, method, false, urlFlag);
    }

    protected ILklTkReqMethod(String url, String templateWord, String method, boolean encrypt, String urlFlag) {
        this.url = url;
        this.templateWord = templateWord;
        this.method = method;
        if (method.equals(LklpayConst.GET)) {
            this.contentType = MediaType.APPLICATION_FORM_URLENCODED;
        } else {
            this.contentType = MediaType.APPLICATION_JSON;
        }
        this.encrypt = encrypt;
        this.urlFlag = urlFlag;
    }

    protected ILklTkReqMethod(String url, String templateWord, String method, MediaType contentType) {
        this(url, templateWord, method, contentType, false);
    }

    protected ILklTkReqMethod(String url, String templateWord, String method, MediaType contentType, boolean encrypt) {
        this.url = url;
        this.templateWord = templateWord;
        this.method = method;
        this.contentType = contentType;
        this.encrypt = encrypt;
        this.urlFlag = "saas";
    }

    private final String url;

    private final String templateWord;

    /**
     * get或者post
     */
    private final String method;

    private final MediaType contentType;

    private final boolean encrypt;

    /**
     * 有saas和open两种
     */
    private final String urlFlag;
}
