package com.ruoyi.ss.article.domain.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * 协议类型
 * @author wjh
 * 2024/5/10
 */
@Getter
@AllArgsConstructor
public enum LicenceType {

    USER("user", "ss.licence.user.id"),     // 用户协议
    PRIVACY("privacy", "ss.licence.privacy.id"),    // 隐私协议
    COLLECT("collection", "ss.licence.collection.id"),  // 个人信息收集清单
    ABOUT("about", "ss.licence.about.id"),  // 关于我们
    MCH("mch", "ss.licence.mch.id");    // 商户协议

    private final String type;    // 类型
    private final String key;     // 配置键值

    public static LicenceType parse(String type) {
        for (LicenceType value : LicenceType.values()) {
            if (Objects.equals(value.getType(), type)) {
                return value;
            }
        }
        return null;
    }
}
