package com.ruoyi.usernotice.enums;

import com.fasterxml.jackson.annotation.JsonCreator;

import java.util.Objects;

/**
 * 消息标题和内容
 */
public enum NoticeEnums {

    USE("订单已完成", "您的订单已核销完成，点击查看详情"),

    REFUND("订单已退款", "您的订单已退款完成，点击查看详情"),

    ;

    private String title;

    private String content;

    NoticeEnums(String title, String content) {
        this.title = title;
        this.content = content;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getTitle() {
        return title;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getContent() {
        return content;
    }

    @JsonCreator
    public static NoticeEnums getByCode(String title) {
        for (NoticeEnums value : NoticeEnums.values()) {
            if (Objects.equals(title, value.getTitle())) {
                return value;
            }
        }
        return null;
    }

}
