import api from "./core/api";
import request from "./core/request";

/**
 * @description: 首页-商户、签约、收运统计
 */
export async function queryStatisticsForWeChat(): Promise<Resp<API.StatisticsDto>> {
    return request(api.kitchenWasteUrl + '/wasteCollectionContract/statisticsForWeChat', { method: 'GET' });
}

/**
 * @description: 首页-推荐产生单位
 */
export async function queryRecommendForWeChat(lat: number, lon: number): Promise<Resp<API.RecommendDto[]>> {
    return request(api.kitchenWasteUrl + '/wasteCollectionRecord/recommendForWeChat', {
        method: 'GET',
        data: {
            lat,
            lon
        }
    });
}

/**
 * @description: 首页-获取收运公司信息
 */
export async function getEntitieInfo(): Promise<Resp<any>> {
    return request(api.kitchenWasteUrl + '/wasteCollectionContract/getEntitieInfo', { method: 'GET' });
}

/**
 * @description: 电子五连-获取车辆
 */
export async function queryCarList(): Promise<Resp<API.CarListDot[]>> {
    return request(api.kitchenWasteUrl + '/wasteCollectionRecord/getCar', {
        method: 'GET'
    });
}

/**
 * @description: 电子五连-提交
 */
export async function submitForWl(data: any): Promise<Resp<any>> {
    return request(api.kitchenWasteUrl + '/wasteCollectionRecord/addWasteCollectionRecord', {
        method: 'POST',
        data
    });
}


/**
 * @description: 以签约商户列表
 */
export async function getSignListForWeChat(): Promise<Resp<API.SignListDto[]>> {
    return request(api.kitchenWasteUrl + '/wasteCollectionContract/getSignListForWeChat', {
        method: 'GET'
    });
}

/**
 * @description: 未签约商户下拉
 */
export async function getNotSignEntities(): Promise<Resp<API.MerchantsListDot[]>> {
    return request(api.kitchenWasteUrl + '/wasteCollectionContract/getNotSignEntitiesForWeChat', {
        method: 'GET'
    });
}

/**
 * @description: 已经签约商户下拉
 */
export async function getSignEntities(): Promise<Resp<API.MerchantsListDot[]>> {
    return request(api.kitchenWasteUrl + '/wasteCollectionContract/getSignEntitiesForWeChat', {
        method: 'GET'
    });
}

/**
 * @description: 添加商户-提交
 */
export async function addWasteCollectionContract(data: any): Promise<Resp<any>> {
    return request(api.kitchenWasteUrl + '/wasteCollectionContract/addWasteCollectionContract', {
        method: 'POST',
        data
    });
}

/**
 * @description: 收运记录
 */
export async function getCollectionListForWeChat(): Promise<Resp<API.CollectionListDto[]>> {
    return request(api.kitchenWasteUrl + '/wasteCollectionRecord/getCollectionListForWeChat', {
        method: 'GET',
    });
}