import httpClient from '@/common/http-client';
import channelExcelHeader from "@/modules/attractMgt/service/mock/channelExcelHeader.json";
import channelDetailExcelHeader from "@/modules/attractMgt/service/mock/channelDetailExcelHeader.json";

// 공통 코드.
const getCommCode = (params) => {
    return httpClient.post('/api/v1/bo/comm/getCode', params, { withCredentials: false });
}

// 유치채널현황 엑셀다운로드 목록 조회
const channelListExcel = (params) => {
    return httpClient.post('/api/v1/bo/attractMgt/channelListExcel', params);
}

// channelDetail
const channelDetail = (params) => {
    return httpClient.post('/api/v1/bo/attractMgt/channelDetail', params, { withCredentials: false});
}

// 발송건수 엑셀 다운로드
const sendNumberListExcel = (params) => {
    return httpClient.post('/api/v1/bo/attractMgt/sendNumberListExcel', params, { withCredentials: false});
}

const getExcelHeader = category => {
    // 엑셀에 출력할 Header 정보를 Mockup 데이터로 관리한다.
    return new Promise(function(resolve, reject) {
        let header = [];
        switch (category) {
            case 'CHANNEL':
                header = channelExcelHeader.header;
                break;
            case 'CHANNELDETAIL':
                header = channelDetailExcelHeader.header;
                break;
            default:
                header = '';
                break;
        }
        resolve(header);
    });
};

export default {
    getCommCode,
    getExcelHeader,
    channelListExcel,
    channelDetail,
    sendNumberListExcel,
}
