package com.simuwang.base.common.enums;

import lombok.Getter;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

@Getter
public enum ReportType {
    MONTHLY(0, "月报", new String[]{"月", "月度", "月报"}),
    QUARTERLY(1, "季报", new String[]{"季", "季度", "季报"}),
    ANNUALLY(2, "年报", new String[]{"年", "年度", "年报"});

    private final int type;
    private final String label;
    private final String[] patterns;

    ReportType(int type, String label, String[] patterns) {
        this.type = type;
        this.label = label;
        this.patterns = patterns;
    }

    public static String getAllPatterns() {
        return String.join("|", patterns());
    }

    public static List<String> patterns() {
        return Arrays.stream(ReportType.values()).flatMap(e -> Arrays.stream(e.getPatterns())).collect(Collectors.toList());
    }
}
