package com.yc.ship.module.trade.enums;


import com.yc.ship.framework.common.core.IntArrayValuable;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Arrays;

/**
 * 退款渠道,分销、旅行社为平台产品渠道，门市、小程序、窗口
 *
 */
@RequiredArgsConstructor
@Getter
public enum RefundChannelEnum implements IntArrayValuable {
    OTA(0, "分销"),
    OTC(1, "旅行社"),
    MINI_APP(3, "小程序"),
    WINDOW(4, "窗口"),
    BACKEND(6, "后台");



    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(RefundChannelEnum::getType).toArray();

    /**
     * 类型值
     */
    private final Integer type;
    /**
     * 状态名
     */
    private final String name;

    @Override
    public int[] array() {
        return ARRAYS;
    }

    public static RefundChannelEnum valueOf(Integer type){
        return Arrays.stream(RefundChannelEnum.values()).filter(item->item.type.equals(type)).findFirst().get();
    }
}
