import React,{useState,useEffect} from 'react';

export const METHODS={
    LOGIN_METHOD:1,
    DOWNLOADJSON_METHOD:2,
    UPLOADJSON_METHOD:3,

    STORECOVERAGE_METHOD:4,
    STORECOVERAGE_STATUS_METHOD:5,
    UPLOADIMAGES_METHOD:6,

    GETCOVERAGE_METHOD:7,
    GETCOVERAGE_CLIENT_METHOD:8,
    GETOTP_METHOD:9,
    UPLOADJSON_DETAIL_METHOD:10,
    COVERAGESTATUS_DETAIL_METHOD:11,
    UPLOAD_STOREGEOTAG_IMAGES_METHOD:12,
    CHECKOUTDETAIL_METHOD:13,
    CHECKOUTDETAIL_CLIENT_METHOD:14,
    JOURNEYPLAN_METHOD:15,
    DELETECOVERAGE_METHOD:16,
    COVERAGENOTALLOW_METHOD:17,
    CHANGEPASSWORD_METHOD:18,
    CREATEJP_METHOD:19,
    UPLOADATTENDANCE_METHOD:20,
    NOTICEBOARD_BANNER:21,
    CREATEJP_METHOD_SUPWISE:22,
    DELETECOVERAGE_METHOD_SUPWISE:23,
    UPLOADTAJSON_METHOD:24,
    DISTRIBUTOR_COVERAGE:25,
    DISTRIBUTOR_CHECKOUT_SUP:26,
    UPLOAD_JSON_DIRECT:27
    
}



export const DOWNLOAD_TYPES={
   
}

export function getMethodName(type){
    switch(type){
        case METHODS.LOGIN_METHOD: return 'DeviceLoginSup';
        case METHODS.DOWNLOADJSON_METHOD: return 'DownloadJson';
        case METHODS.UPLOADJSON_METHOD: return 'UploadJson';
        case METHODS.STORECOVERAGE_METHOD: return 'StoreCoverageSup';
        case METHODS.STORECOVERAGE_STATUS_METHOD: return 'CoverageStatusSup';
        case METHODS.UPLOADIMAGES_METHOD: return 'Uploadimages';
        case METHODS.GETCOVERAGE_METHOD: return 'CoverageSup';
        case METHODS.GETCOVERAGE_CLIENT_METHOD: return 'CoverageDetail_latest_client';
        case METHODS.GETOTP_METHOD: return 'GetOtp';
        case METHODS.UPLOADJSON_DETAIL_METHOD: return 'UploadJsonDetail';
        case METHODS.COVERAGESTATUS_DETAIL_METHOD: return 'CoverageStatusDetail';
        case METHODS.UPLOAD_STOREGEOTAG_IMAGES_METHOD: return 'Upload_StoreGeoTag_IMAGES';
        case METHODS.CHECKOUTDETAIL_METHOD: return 'StoreCheckOutSup';
        case METHODS.CHECKOUTDETAIL_CLIENT_METHOD: return 'CheckoutDetail_client';
        case METHODS.JOURNEYPLAN_METHOD: return 'JourneyPlan';
        case METHODS.DELETECOVERAGE_METHOD: return 'DeleteCoverageSup';
        case METHODS.DELETECOVERAGE_METHOD_SUPWISE: return 'DeleteCoverageStorewiseSup';
        case METHODS.COVERAGENOTALLOW_METHOD: return 'CoverageNotAllow';
        case METHODS.UPLOADTAJSON_METHOD: return 'AttendanceTeamSup';
        case METHODS.CHANGEPASSWORD_METHOD: return 'ChangePassword';
        case METHODS.CREATEJP_METHOD: return 'CreateJourneyPlan';
        case METHODS.CREATEJP_METHOD_SUPWISE: return 'CreateJourneyPlanSup';
        case METHODS.UPLOADATTENDANCE_METHOD: return 'SupAttendance';
        case METHODS.NOTICEBOARD_BANNER: return 'Sup_NoticeBoard';
        case METHODS.DISTRIBUTOR_COVERAGE: return 'DistributorPointCoverageSup';
        case METHODS.DISTRIBUTOR_CHECKOUT_SUP: return 'DistributorPointCheckoutSup';

        // by Ajeet
        case METHODS.UPLOAD_JSON_DIRECT: return 'UploadJsonDirect';

        default : return '';
    }
}


export function getFolderName(filename=''){
    var foldername='';
    if(filename.includes("_StoreImg-") || filename.includes("_NonworkImg-") || filename.includes("_GroomingImg-") || filename.includes("_CheckoutImg-")){
        foldername = "SupCoverageImages";
    }           
    else if(filename.includes("_GeoTag-") || filename.includes("_DBGeoTag-") ){
        foldername = "SupGeoTagImages";
    }    
    return foldername;
}

