package com.storlead.wx.pojo.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;

/**
 * 企业微信token
 *
 * @author blank
 * @since 2021-6-15
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode()
@Accessors(chain = true)
@ApiModel(value="WechatToken对象", description="企业微信token")
public class WechatToken {

    private static final long serialVersionUID = 1L;

    public WechatToken(String type, String token) {
        this.type = type;
        this.token = token;

        //计算过期时间
        LocalDateTime expiresIn = LocalDateTime.now();
        expiresIn = expiresIn.plusSeconds(5400);
        this.expiresIn = expiresIn;
    }

    @ApiModelProperty(value = "token类型")
    private String type;

    @ApiModelProperty(value = "token")
    private String token;

    @ApiModelProperty(value = "token过期时间 固定为7200秒 我们取5400秒 一个半小时")
    private LocalDateTime expiresIn;


}
