package com.simuwang.base.common.enums;

import java.util.stream.Stream;
import java.util.zip.Inflater;

/**
 * FileName: Frequency
 * Author:   chenjianhua
 * Date:     2024/9/18 23:19
 * Description: ${DESCRIPTION}
 */
public enum Frequency {

    DAY(1, "日频"),WEEK(2, "周频"),MONTH(3, "月频"),QUARTER(4,"季频"),
    HALF_YEAR(5,"半年"),YEAR(6,"年频"),OTHER(-1,"无固定");

    private Integer code;

    private String info;

    Frequency(Integer code, String info) {
        this.code = code;
        this.info = info;
    }

    public static Frequency getFrequencyByCode(Integer code) {
        return Stream.of(Frequency.values()).filter(e -> e.code.equals(code)).findFirst().orElse(null);
    }

    public Integer getCode() {
        return code;
    }

    public String getInfo() {
        return info;
    }
}

