package com.dxhy.extend.util;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import org.apache.commons.lang3.StringUtils;

import com.dxhy.common.enums.RzclztEnum;
import com.dxhy.common.enums.RzztEnum;

/**
 * @author dxhy
 */
public class InvoiceTypeUtils {
    public static String invoiceTypeName(String invoiceType) {
        String invoiceName = "";
        if (StringUtils.isNotBlank(invoiceType)) {
            switch (invoiceType) {
                case "01":
                    invoiceName = "增值税专用发票";
                    break;
                case "08":
                    invoiceName = "增值税电子专用发票";
                    break;
                case "04":
                    invoiceName = "增值税普通发票";
                    break;
                case "10":
                    invoiceName = "增值税电子普通发票";
                    break;
                case "11":
                    invoiceName = "增值税普通发票（卷式）";
                    break;
                case "14":
                    invoiceName = "增值税电子普通发票（通行费）";
                    break;
                case "03":
                    invoiceName = "机动车销售统一发票";
                    break;
                case "15":
                    invoiceName = "二手车销售统一发票";
                    break;
                case "92":
                    invoiceName = "火车票";
                    break;
                case "90":
                    invoiceName = "航空客运电子客票行程单";
                    break;
                case "89":
                    invoiceName = "公路运输客票(实名)";
                    break;
                case "88":
                    invoiceName = "水路运输客票(实名)";
                    break;
                case "87":
                    invoiceName = "其他运输客票(实名)";
                    break;
                case "91":
                    invoiceName = "出租车票";
                    break;
                case "94":
                    invoiceName = "汽车票";
                    break;
                case "101":
                    invoiceName = "过路桥票";
                    break;
                case "95":
                    invoiceName = "定额发票";
                    break;
                case "97":
                    invoiceName = "通用机打票";
                    break;
                case "98":
                    invoiceName = "政府非税收收入一般缴款书";
                    break;
                case "102":
                    invoiceName = "完税证明";
                    break;
                case "103":
                    invoiceName = "代扣代缴税收通用缴款书";
                    break;
                case "17":
                    invoiceName = "海关进口增值税专用缴款书";
                    break;
                case "99":
                    invoiceName = "国外发票";
                    break;
                case "00":
                    invoiceName = "可报销其他发票";
                    break;
                case "31":
                    invoiceName = "电子发票（增值税专用发票）";
                    break;
                case "32":
                    invoiceName = "电子发票（普通发票）";
                    break;
//                case "85":
//                    invoiceName = "可报销其他发票";
//                    break;
//                case "86":
//                    invoiceName = "滴滴出行行程单";
//                    break;
//                case "93":
//                    invoiceName = "飞机票";
//                    break;
//                case "96":
//                    invoiceName = "国际小票";
//                    break;
                default:
                    break;
            }
        }
        return invoiceName;
    }

    public static String rzztEnumTransfer(String authenticationStatus) {
        List<RzztEnum> result = Arrays.stream(RzztEnum.values()).filter(e -> e.getRzztDm().equals(authenticationStatus))
            .collect(Collectors.toList());

        if (result.isEmpty()) {
            return "未知类型";
        }
        RzztEnum rzztEnum = result.get(0);
        return "退税认证".equals(rzztEnum.getRzztMc(rzztEnum.getIndex())) ? "已认证" : rzztEnum.getRzztMc(rzztEnum.getIndex());

    }

    public static String rzclztEnumTransfer(String authenticationDetailStatus) {
        List<RzclztEnum> result = Arrays.stream(RzclztEnum.values())
            .filter(e -> e.getRzclztDm().equals(authenticationDetailStatus)).collect(Collectors.toList());

        if (result.isEmpty()) {
            return "未知类型";
        }
        RzclztEnum rzztEnum = result.get(0);
        return rzztEnum.getRzclztMc(rzztEnum.getIndex());

    }
}
