package cn.superdesk.uniorder.controller._common;

import cn.superdesk.uniorder.common.enums.accounting.AccountingOrderInvoiceApplyStatusEnum;
import cn.superdesk.uniorder.common.rest.response.R;
import cn.superdesk.uniorder.common.rest.response.ResponseResultOuterUtils;
import cn.superdesk.uniorder.dto.vo._common.EnumSelectIntegerStringVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

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

/**
 * @Description: Java类作用描述
 * @Author: linjinyu
 * @CreateDate: 2022/5/13 3:41 下午
 * @UpdateUser: linjinyu
 * @UpdateDate: 2022/5/13 3:41 下午
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
@Api(value = "公共接口-下拉列表-对账单", tags = {"公共接口-下拉列表-对账单"})
@Slf4j
@RestController
@RequestMapping("/common/select/accounting")
public class CommonSelectAccountingController {

    @ApiOperation(value = "对账单-申请状态-积分结算", notes = "积分结算2.1")
    @RequestMapping(value = "/customer/customerCredit/invoiceApplyStatus", method = RequestMethod.POST)
    @ResponseBody
    public R<List<EnumSelectIntegerStringVo>> selectAccountingOrderInvoiceApplyStatusEnum() {
        List<EnumSelectIntegerStringVo> selectVos = new ArrayList<>();

        for (AccountingOrderInvoiceApplyStatusEnum value : AccountingOrderInvoiceApplyStatusEnum.values()) {
            selectVos.add(EnumSelectIntegerStringVo
                    .builder()
                    .key(value.getKey())
                    .desc(value.getDesc())
                    .build()
            );
        }

        return ResponseResultOuterUtils.createSuccesResult("SUCCESS", selectVos);
    }
}
