import config from "../config"

export default {
    list: {
        url: config.base_dev_url + "farm/list",
        type: "get",
    },
    weatherRiskVirtualFarmList: {
        url: config.base_dev_url + "farm/weatherRiskVirtualFarmList?key="+config.mini_key,
        type: "get",
    },
    getTimeLine: {
        url: config.base_dev_url + "fairyland/getNodesByFarmId",
        type: "get",
    },
    getReportData: {
        url: config.base_dev_url + "fairyland/predict",
        type: "post",
    },
    getCataclysmTimeLine: {
        url: config.base_dev_url + "fairyland/getDisasterNodesByFarmId",
        type: "get",
    },
    getCataclysmReportData: {
        url: config.base_dev_url + "fairyland/disasterPredict",
        type: "post",
    },
    getDisasterJudgment: {
        url: config.base_dev_url + "fairyland/disasterJudgment",
        type: "post",
    },
    fetchFarmDetail: {
        url: config.base_dev_url + "farm/getById",
        type: "get",
    },
    fetchFarmImgs: {
        url: config.base_dev_url + "image/list",
        type: "post",
    },
    getLiveStart: {
        url: config.base_dev_url + "farm/liveStart",
        type: "get",
    },
    gardenItemChart: {
        url: config.base_dev_url + "plugin_weather_warning_record/gardenWarningInfoCharts?key="+config.mini_key,
        type: "get",
        mockCondition: (p)=>{
            return p.farmId === "90888";
        },mockFun:function(p){
            return new Promise((resolve, reject) => {
                //天水
                if(p.farmId === "90888"){
                    resolve({
                        "code": 0,
                        "msg": "success",
                        "data": {
                            "date": null,
                            "periodHumidnessMax": null,
                            "periodHumidnessMin": null,
                            "periodLightMax": null,
                            "periodLightMin": null,
                            "periodTempMax": null,
                            "periodTempMin": null,
                            "rowList": [],
                            "showStatus": null,
                            "weatherData": [
                                {
                                    "cloud": 25,
                                    "districtId": 3186,
                                    "first": null,
                                    "fxDate": "2025-04-17",
                                    "gridId": null,
                                    "humidity": 79,
                                    "iconDay": "",
                                    "iconNight": "",
                                    "id": "700512784344944703",
                                    "pId": null,
                                    "preSunshine": 9,
                                    "precip": 0,
                                    "pressure": 995,
                                    "sunrise": "06:04",
                                    "sunset": "18:48",
                                    "tempAvg": 21,
                                    "tempMax": 31,
                                    "tempMin": 12,
                                    "textDay": "多云",
                                    "textNight": "中雨",
                                    "uvIndex": 3,
                                    "wind360Day": 180,
                                    "wind360Night": 135,
                                    "windDirDay": "南风",
                                    "windDirNight": "东南风",
                                    "windScaleDay": "1-3",
                                    "windScaleNight": "1-3",
                                    "windSpeedDay": 16,
                                    "windSpeedNight": 16
                                },
                                {
                                    "cloud": 91,
                                    "districtId": 3186,
                                    "first": null,
                                    "fxDate": "2025-04-18",
                                    "gridId": null,
                                    "humidity": 94,
                                    "iconDay": "",
                                    "iconNight": "",
                                    "id": "700512784344944704",
                                    "pId": null,
                                    "preSunshine": 1,
                                    "precip": 10.7,
                                    "pressure": 994,
                                    "sunrise": "06:03",
                                    "sunset": "18:48",
                                    "tempAvg": 25,
                                    "tempMax": 26,
                                    "tempMin": 7,
                                    "textDay": "中雨",
                                    "textNight": "阵雨",
                                    "uvIndex": 3,
                                    "wind360Day": 180,
                                    "wind360Night": 180,
                                    "windDirDay": "南风",
                                    "windDirNight": "南风",
                                    "windScaleDay": "1-3",
                                    "windScaleNight": "1-3",
                                    "windSpeedDay": 16,
                                    "windSpeedNight": 16
                                },
                                {
                                    "cloud": 63,
                                    "districtId": 3186,
                                    "first": null,
                                    "fxDate": "2025-04-19",
                                    "gridId": null,
                                    "humidity": 94,
                                    "iconDay": "",
                                    "iconNight": "",
                                    "id": "700512784344944705",
                                    "pId": null,
                                    "preSunshine": 4,
                                    "precip": 1.5,
                                    "pressure": 995,
                                    "sunrise": "06:02",
                                    "sunset": "18:49",
                                    "tempAvg": 25,
                                    "tempMax": 31,
                                    "tempMin": 9,
                                    "textDay": "阵雨",
                                    "textNight": "阵雨",
                                    "uvIndex": 2,
                                    "wind360Day": 180,
                                    "wind360Night": 0,
                                    "windDirDay": "南风",
                                    "windDirNight": "北风",
                                    "windScaleDay": "1-3",
                                    "windScaleNight": "1-3",
                                    "windSpeedDay": 16,
                                    "windSpeedNight": 3
                                },
                                {
                                    "cloud": 25,
                                    "districtId": 3186,
                                    "first": null,
                                    "fxDate": "2025-04-20",
                                    "gridId": null,
                                    "humidity": 88,
                                    "iconDay": "",
                                    "iconNight": "",
                                    "id": "700512784344944706",
                                    "pId": null,
                                    "preSunshine": 9,
                                    "precip": 0,
                                    "pressure": 995,
                                    "sunrise": "06:01",
                                    "sunset": "18:49",
                                    "tempAvg": 26,
                                    "tempMax": 29,
                                    "tempMin": 15,
                                    "textDay": "阵雨",
                                    "textNight": "多云",
                                    "uvIndex": 3,
                                    "wind360Day": 180,
                                    "wind360Night": 180,
                                    "windDirDay": "南风",
                                    "windDirNight": "南风",
                                    "windScaleDay": "1-3",
                                    "windScaleNight": "1-3",
                                    "windSpeedDay": 16,
                                    "windSpeedNight": 16
                                },
                                {
                                    "cloud": 25,
                                    "districtId": 3186,
                                    "first": null,
                                    "fxDate": "2025-04-21",
                                    "gridId": null,
                                    "humidity": 85,
                                    "iconDay": "",
                                    "iconNight": "",
                                    "id": "700512784344944707",
                                    "pId": null,
                                    "preSunshine": 9,
                                    "precip": 0,
                                    "pressure": 994,
                                    "sunrise": "06:00",
                                    "sunset": "18:50",
                                    "tempAvg": 26,
                                    "tempMax": 21,
                                    "tempMin": 7,
                                    "textDay": "多云",
                                    "textNight": "中雨",
                                    "uvIndex": 7,
                                    "wind360Day": 225,
                                    "wind360Night": 0,
                                    "windDirDay": "西南风",
                                    "windDirNight": "北风",
                                    "windScaleDay": "1-3",
                                    "windScaleNight": "1-3",
                                    "windSpeedDay": 16,
                                    "windSpeedNight": 3
                                },
                                {
                                    "cloud": 55,
                                    "districtId": 3186,
                                    "first": null,
                                    "fxDate": "2025-04-22",
                                    "gridId": null,
                                    "humidity": 77,
                                    "iconDay": "",
                                    "iconNight": "",
                                    "id": "700512784344944708",
                                    "pId": null,
                                    "preSunshine": 5,
                                    "precip": 2,
                                    "pressure": 996,
                                    "sunrise": "06:00",
                                    "sunset": "18:50",
                                    "tempAvg": 25,
                                    "tempMax": 22,
                                    "tempMin": 6,
                                    "textDay": "中雨",
                                    "textNight": "中雨",
                                    "uvIndex": 3,
                                    "wind360Day": 0,
                                    "wind360Night": 0,
                                    "windDirDay": "北风",
                                    "windDirNight": "北风",
                                    "windScaleDay": "1-3",
                                    "windScaleNight": "1-3",
                                    "windSpeedDay": 3,
                                    "windSpeedNight": 3
                                },
                                {
                                    "cloud": 62,
                                    "districtId": 3186,
                                    "first": null,
                                    "fxDate": "2025-04-23",
                                    "gridId": null,
                                    "humidity": 87,
                                    "iconDay": "",
                                    "iconNight": "",
                                    "id": "700512784344944709",
                                    "pId": null,
                                    "preSunshine": 4,
                                    "precip": 13.8,
                                    "pressure": 995,
                                    "sunrise": "05:59",
                                    "sunset": "18:50",
                                    "tempAvg": 22,
                                    "tempMax": 26,
                                    "tempMin": 12,
                                    "textDay": "小雨",
                                    "textNight": "小雨",
                                    "uvIndex": 7,
                                    "wind360Day": 0,
                                    "wind360Night": 135,
                                    "windDirDay": "北风",
                                    "windDirNight": "东南风",
                                    "windScaleDay": "1-3",
                                    "windScaleNight": "1-3",
                                    "windSpeedDay": 3,
                                    "windSpeedNight": 3
                                }
                            ]
                        },
                        "extData": null,
                        "success": true
                    })
                }
            })
        }
    },
    fetchFarmDetail: {
        url: config.base_dev_url + "farm/getById?key="+config.mini_key,
        type: "get",
    },
    fetchFarmWorkList: {
        url: config.base_url +"farm_work/list",
        type: "get",
    },

    farmImgList: {
        url: config.base_dev_url + "image/list?key="+config.mini_key,
        type: "post",
    },

    weather_warning_land_check: {
        url: config.base_dev_url + "land_check/weather_warning_land_check?key="+config.mini_key,
        type: "post",
        mockCondition: (p)=>{
            return p.farmId === "90888" || p.farmId === "92938";
        },mockFun:function(p){
            return new Promise((resolve, reject) => {
                //柏桥
                if(p.farmId === "90888" || p.farmId === "92938"){
                    resolve({
                        "code": 0,
                        "msg": "success",
                        "data": {
                            "agrotype": "赤红壤",
                            "aspect": "阴坡",
                            "changesList": [
                                null,
                                null,
                                null
                            ],
                            "content": "未来一周温度较过去一周上升了3.0℃，花粉失活风险累积，干旱风险达到54.1%，预计未来一周阴雨低温达到131.%，预计未来面临阴天寡照1级，无人机监测到高州市的桂味荔枝普遍处于扬花期。",
                            "labels": [
                                "干旱风险",
                                "低温阴雨",
                                "阴天寡照"
                            ],
                            "risk1Content": "未来一周温度较过去一周上升了3.0℃，花粉失活风险累积，干旱风险达到54.1%，需启动冷链花粉储备，实施早晚两次人工点授。[newline]原理介绍：干旱风险评估基于温湿度时空耦合效应，当气温持续较高、湿度持续较低时，花粉活力将快速衰减；导致柱头黏液渗透压异常，阻碍花粉管萌发。需特别监测树冠阳面花朵。",
                            "risk2Content": "预计未来一周阴雨低温达到131.%，可利用无人机吹花，提高授粉受精效能。[newline]原理介绍：低温阴雨风险评估综合考量降雨强度、持续时长及温湿组合。当果园处于气温较低且相对湿度较高条件时，花药开裂受阻；土壤含水量饱和将诱发根系窒息，加剧花穗衰败。",
                            "risk3Content": "预计未来面临阴天寡照1级，[newline]原理介绍：阴天寡照评估依据光照强度和持续时长评估，当有效光照较低持续5天以上时，花体碳氮比失衡，导致授粉受精不良，需重点关注树冠中下层花穗。",
                            "slope": 4.98,
                            "valueMaxList": [
                                54.1,
                                13,
                                18
                            ],
                            "valuesList": [
                                [
                                    38.92,
                                    38.92,
                                    38.92,
                                    38.92,
                                    38.92,
                                    38.92,
                                    12.78
                                ],
                                [
                                    0,
                                    14.25,
                                    108.3,
                                    19.39,
                                    16.82,
                                    12.87,
                                    14.25
                                ],
                                [
                                    0,
                                    0,
                                    0,
                                    0,
                                    0,
                                    0,
                                    0
                                ]
                            ]
                        },
                        "extData": null,
                        "success": true
                    })
                }
            })
        }
    },

    getSampleFiles: {
        url: config.base_dev_url + "image/getSampleFiles?key="+config.mini_key,
        type: "get",
        mockCondition: (p)=>{
            return p.farmId === "90888";
        },mockFun:function(p){
            return new Promise((resolve, reject) => {
                //天水
                if(p.farmId === "90888"){
                    resolve({
                        "code": 0,
                        "msg": "",
                        "data": {
                            "production_info": {
                                "production": Math.floor(Math.random() * (100 - 75 + 1)) + 75,
                                "cihua_ratio": 30,
                                "quality": 94
                            },
                            "meta_info": {
                                "nutrition_info": {
                                    "statement": "无营养异常",
                                    "key": "营养"
                                },
                                "prescription_info": {
                                    "statement": "近期农事复核良好",
                                    "key": "农事"
                                },
                                "branch_num": Math.floor(Math.random() * (90 - 70 + 1)) + 70,
                                "type_id": "苹果",
                                "grow_alert_info": {
                                    "statement": "近期无异常",
                                    "key": "异常"
                                },
                                "dp_alert_info": {
                                    "statement": "近期无异常",
                                    "key": "病虫"
                                },
                                "age": "--",
                                "crown": Math.floor(Math.random() * (15 - 10 + 1)) + 10
                            },
                            "ecology_info": {
                                "ventilation": Math.floor(Math.random() * (100 - 90 + 1)) + 90,
                                "transmittance": Math.floor(Math.random() * (100 - 90 + 1)) + 90,
                                "dp_situation": 0
                            }
                        },
                        "extData": [
                            {
                                "unit": "%",
                                "field": "ventilation",
                                "id": "713142309679534080",
                                "label": "通风率",
                                "speciesInfoId": "1"
                            },
                            {
                                "unit": "%",
                                "field": "transmittance",
                                "id": "713142627154792448",
                                "label": "透光率",
                                "speciesInfoId": "1"
                            },
                            {
                                "unit": "斤/亩",
                                "field": "production",
                                "id": "713140632805183488",
                                "label": "产量预估",
                                "speciesInfoId": "1"
                            },
                            {
                                "unit": "%",
                                "field": "quality",
                                "id": "713142309679534080",
                                "label": "高质果率",
                                "speciesInfoId": "1"
                            },
                            {
                                "unit": "平方米",
                                "field": "crown",
                                "id": "713142627154792448",
                                "label": "冠幅",
                                "speciesInfoId": "1"
                            },
                            {
                                "unit": "%",
                                "field": "dp_situation",
                                "id": "713142767462649856",
                                "label": "病虫比例",
                                "speciesInfoId": "1"
                            },
                            {
                                "unit": "%",
                                "field": "chousui_ratio",
                                "id": "713140490274344960",
                                "label": "抽穗率",
                                "speciesInfoId": "1"
                            },
                            {
                                "unit": "",
                                "field": "branch_num",
                                "id": "713140835998240768",
                                "label": "枝条树",
                                "speciesInfoId": "1"
                            },
                            {
                                "unit": "cm",
                                "field": "height",
                                "id": "713141801690599424",
                                "label": "株高",
                                "speciesInfoId": "1"
                            },
                            {
                                "unit": "",
                                "field": "phenology",
                                "id": "713142078221062144",
                                "label": "物候期",
                                "speciesInfoId": "1"
                            },
                            {
                                "unit": "%",
                                "field": "cihua_ratio",
                                "id": "713140490274344961",
                                "label": "雌花率",
                                "speciesInfoId": "1"
                            }
                        ],
                        "success": true
                    })
                }
            })
        }
    },
}

