package com.hfkj.openapi.v1.model;

import java.util.Objects;

/**
 * toekn 授权类型
 * @className: TokenGrantType
 * @author: HuRui
 * @date: 2023/5/23
 **/
public enum TokenGrantType {
    CLIENT_CREDENTIALS("client_credentials", "客户访问凭证"),
    ;

    private String code;

    private String name;


    TokenGrantType(String code, String name) {
        this.code = code;
        this.name = name;
    }

    /**
     * @return
     */
    public static TokenGrantType getDataByCode(String code) {
        for (TokenGrantType ele : values()) {
            if (Objects.equals(code,ele.getCode())) {
                return ele;
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
