package cn.superdesk.uniorder.dubbo.consumer.operationCenter.base;

import cn.superdesk.data.extract.enums.opCenter.*;
import cn.superdesk.uniorder.dto.vo.operationCenter.base.OperationCenterVo;
import cn.superdesk.uniorder.dubbo.facade.operationCenter.payment.DubboOperationCenterPaymentService;
import com.alibaba.dubbo.config.annotation.Reference;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author : zx
 * @Create : 2023/3/28 10:49
 * Description : 提供服务
 */
@Slf4j
@Component
public class OperationCenterBaseDubboService {
    @Reference(version = "1.0.0", timeout = 30000, retries = -1)
    private DubboOperationCenterPaymentService dubboOperationCenterPaymentService;

    public List<OperationCenterVo> getPlatformCode() {
        List<OperationCenterVo> platformList=new ArrayList<>();

        for (OpCenterBizPlatformEnum platformEnum : OpCenterBizPlatformEnum.values()) {
            //1.00先让前端只展示-服务之窗、福利商城
            if ("FWZC".equals(platformEnum.getCode()) || "FLSC".equals(platformEnum.getCode())) {
                OperationCenterVo vo =new OperationCenterVo();
                vo.setCode(platformEnum.getCode());
                vo.setName(platformEnum.getName());
                platformList.add(vo);
            }

        }
        return platformList;
    }

    public List<OperationCenterVo> getOrderType() {
        List<OperationCenterVo> orderTypeList=new ArrayList<>();

        for (OpCenterOrderTypeEnum orderTypeVo : OpCenterOrderTypeEnum.values()) {
            if ("FLSC".equals(orderTypeVo.getCode()) || "FZS".equals(orderTypeVo.getCode())) {
                OperationCenterVo vo = new OperationCenterVo();
                vo.setCode(orderTypeVo.getCode());
                vo.setName(orderTypeVo.getName());
                orderTypeList.add(vo);
            }
        }
        return orderTypeList;
    }


    public List<OperationCenterVo> getOrderBizType() {
        List<OperationCenterVo> orderBizType=new ArrayList<>();

        for (OpCenterOrderBizTypeEnum orderBizTypeVo : OpCenterOrderBizTypeEnum.values()) {
            OperationCenterVo vo =new OperationCenterVo();
            vo.setCode(orderBizTypeVo.getCode().toString());
            vo.setName(orderBizTypeVo.getDesc());
            orderBizType.add(vo);
        }
        return orderBizType;
    }

    public List<OperationCenterVo> getOrderPayStatus() {
        List<OperationCenterVo> orderPayStatus=new ArrayList<>();

        for (OpCenterOrderPayStatusEnum orderPayStatusVo : OpCenterOrderPayStatusEnum.values()) {
            OperationCenterVo vo =new OperationCenterVo();
            vo.setCode(orderPayStatusVo.getCode().toString());
            vo.setName(orderPayStatusVo.getDesc());
            orderPayStatus.add(vo);
        }
        return orderPayStatus;
    }

    public List<OperationCenterVo> getTransactionStatus() {
        List<OperationCenterVo> transactionStatus=new ArrayList<>();

        for (OpCenterTransactionStatusEnum transactionStatusVo : OpCenterTransactionStatusEnum.values()) {
            OperationCenterVo vo =new OperationCenterVo();
            vo.setCode(transactionStatusVo.getCode().toString());
            vo.setName(transactionStatusVo.getDesc());
            transactionStatus.add(vo);
        }
        return transactionStatus;

    }

    public List<OperationCenterVo> getAfterSaleStatus() {
        List<OperationCenterVo> afterSaleStatus=new ArrayList<>();

        for (OpCenterPlatformAftersaleStatusEnum afterSaleStatusVo : OpCenterPlatformAftersaleStatusEnum.values()) {
            OperationCenterVo vo =new OperationCenterVo();
            vo.setCode(afterSaleStatusVo.getCode().toString());
            vo.setName(afterSaleStatusVo.getDesc());
            afterSaleStatus.add(vo);
        }
        return afterSaleStatus;
    }

    public List<OperationCenterVo> getAfterSaleType() {
        List<OperationCenterVo> afterSaleType=new ArrayList<>();

        for (OpCenterPlatformAftersaleTypeEnum afterSaleTypeVo : OpCenterPlatformAftersaleTypeEnum.values()) {
            OperationCenterVo vo =new OperationCenterVo();
            vo.setCode(afterSaleTypeVo.getCode().toString());
            vo.setName(afterSaleTypeVo.getDesc());
            afterSaleType.add(vo);
        }
        return afterSaleType;
    }

    public List<OperationCenterVo> getPaymentByOperatorId() {
        return dubboOperationCenterPaymentService.getPaymentByOperatorId();
    }
}
