package com.cool.store.enums.wallet;

import com.cool.store.enums.JoinModeEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * <p>
 * 营帐通门店模式
 * </p>
 *
 * @author wangff
 * @since 2025/11/19
 */
@Getter
@AllArgsConstructor
public enum YztStoreModel {
    // 1.社会加盟 2.强管 3.强加盟 (门店模式)

    SOCIAL_JOIN(1, "社会加盟", Arrays.asList(JoinModeEnum.FRANCHISE_DEPARTMENT, JoinModeEnum.FRANCHISE_COMPANIES)),
    STRONG_MANAGEMENT(2, "强管", Collections.singletonList(JoinModeEnum.FLAGSHIP_STORE)),
    STRONG_JOIN(3, "强加盟", Collections.singletonList(JoinModeEnum.AFFILIATES)),
    ;

    private final Integer model;

    private final String desc;

    /**
     * 对应crm加盟模式枚举类
     */
    private final List<JoinModeEnum> joinModelList;

    public static Integer getYztStoreModel(Integer joinModel) {
        JoinModeEnum joinModelEnum = JoinModeEnum.getModelByCode(joinModel);
        for (YztStoreModel e : YztStoreModel.values()) {
            if (e.joinModelList.contains(joinModelEnum)) {
                return e.model;
            }
        }
        return null;
    }
}
