package com.jeequan.jeepay.core.model.openapi;

import com.alibaba.fastjson.JSONObject;
import com.jeequan.jeepay.core.entity.MchApp;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;

/**
 * TODO
 * 网关api 统一请求参数封装
 * @author crystal
 * @date 2024/4/7 14:28
 */
@Data
@Accessors(chain = true)
public class AccessReq implements Serializable {

    @NotBlank(message="请求流水号[reqId]参数不能为空")
    private String reqId;

    @NotBlank(message="版本[version]参数不能为空")
    private String version;

    @NotBlank(message="请求时间[reqTime]参数不能为空")
    private String reqTime;

    @NotBlank(message="请求签名类型[signType]参数不能为空")
    private String signType;

    @NotBlank(message="签名[sign]参数不能为空")
    private String sign;

    @NotBlank(message="请求业务[bizData]参数不能为空")
    private String bizData;

    private JSONObject bizDataJSON;

    @NotBlank(message="应用[appId]参数不能为空")
    private String appId;

    private MchApp appInfo;

    private String platPriKey;

    private String wayCode;

    private Boolean isApplet = false;

    public String signContent() {
        return "appId" + "=" + appId +
                "&bizData=" + bizData +
                "&reqId=" + reqId +
                "&reqTime=" + reqTime +
                "&signType=" + signType +
                "&version=" + version
                ;
    }

}
