package com.fs.hisStore.enums;

import java.util.Arrays;
import java.util.Collections;
import java.util.Set;
import java.util.stream.Collectors;

/**
 * 设置单店铺的商城
 */
public enum CompanyEnum {
    YISHANYUAN("益善缘"),
    KANGNIAN_TANG("康年堂"),
    SIFU_TANG("四福堂"),
    NMG_MYT("内蒙古一贴"),
    CQ_TYT("重庆泰医堂"),
    CHUNZHENG_TANG("纯正堂");

    private final String companyName;

    CompanyEnum(String companyName) {
        this.companyName = companyName;
    }

    public String getCompanyName() {
        return companyName;
    }

    /**
     * 静态集合，避免每次调用都重新创建
     */
    private static final Set<String> COMPANY_NAMES = Collections.unmodifiableSet(
            Arrays.stream(values())
                    .map(CompanyEnum::getCompanyName)
                    .collect(Collectors.toSet())
    );

    /**
     * 比较是否存在
     *
     * @param companyName
     * @return
     */
    public static boolean contains(String companyName) {
        return COMPANY_NAMES.contains(companyName);
    }
}
