package cn.pluss.platform.ys.impl.v20220527;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
//import cn.pluss.platform.klk.service.KlkReqMethod;
import cn.pluss.platform.yinsheng.v20210929.ReqMethod;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.Date;

@Getter
@Setter
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class ReqEntity {
    private String timeStamp;

    private String method;

    private String charset = "utf-8";

    private String sign;

    private String check;

    private String bizContent;

    private String reqId;

    private String certId = "826521773920170";

    private String version = "1.0";

    public static ReqEntity get(ReqMethod reqMethod) {
        Date date = new Date();
        ReqEntity entity = new ReqEntity();
        entity.timeStamp = DateUtil.format(date, "yyyy-MM-dd HH:mm:ss");
        entity.method = reqMethod.getMethod();
        entity.reqId = "SYB_" + RandomUtil.randomString(4) + DateUtil.format(date, "yyMMddHHmmss");

        return entity;
    }

    public static ReqEntity get(cn.pluss.platform.ys.impl.v20220527.ReqMethod reqMethod) {
        Date date = new Date();
        ReqEntity entity = new ReqEntity();
        entity.timeStamp = DateUtil.format(date, "yyyy-MM-dd HH:mm:ss");
        entity.method = reqMethod.getMethod();
        entity.reqId = "SYB_" + RandomUtil.randomString(4) + DateUtil.format(date, "yyMMddHHmmss");

        return entity;
    }
}
