package com.njzscloud.supervisory.gps.tuqiang.jimi;

import cn.hutool.crypto.digest.DigestUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.njzscloud.supervisory.config.JimiProperties;
import com.njzscloud.supervisory.gps.tuqiang.jimi.support.JimiParam;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

/**
 * 获取access_token
 */
@Getter
@Setter
@ToString
@Accessors(chain = true)
public class OauthTokenGetParam extends JimiParam<OauthTokenGetResult> {
    private String user_id;
    private String user_pwd_md5;
    private String expires_in;

    public OauthTokenGetParam() {
        super("jimi.oauth.token.get");
        JimiProperties jimiProperties = SpringUtil.getBean(JimiProperties.class);
        this.user_id = jimiProperties.getUserId();
        this.user_pwd_md5 = DigestUtil.md5Hex(jimiProperties.getPwd());
        this.expires_in = jimiProperties.getExpires().toString();
    }

    @Override
    public Class<OauthTokenGetResult> resultType() {
        return OauthTokenGetResult.class;
    }

}
