package com.ruoyi.web.controller.portal;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain.SysSdgsat1Introduction;
import com.ruoyi.system.domain.SysSdgsat1Case;
import com.ruoyi.system.service.ISysSdgsat1IntroductionService;
import com.ruoyi.system.service.ISysSdgsat1CaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/portal/sdgsat1")
public class PortalSDGSAT1Controller extends BaseController {

    @Autowired
    private ISysSdgsat1IntroductionService sdgsat1IntroductionService;

    @Autowired
    private ISysSdgsat1CaseService sdgsat1CaseService;

    @GetMapping("/info")
    public AjaxResult getSDGSAT1Info() {
        SysSdgsat1Introduction intro = sdgsat1IntroductionService.selectIntroduction();
        Map<String, Object> data = new HashMap<>();
        if (intro != null) {
            data.put("info", intro);
        }
        return AjaxResult.success(data);
    }

    @GetMapping("/specs")
    public AjaxResult getSDGSAT1Specs() {
        Map<String, Object> specs = new HashMap<>();
        specs.put("orbitHeight", "505 km");
        specs.put("orbitPeriod", "94.6 分钟");
        specs.put("revisitPeriod", "11 天");
        specs.put("designLife", "3 年");
        specs.put("weight", "1850 kg");
        specs.put("dataRate", "450 Mbps");
        return AjaxResult.success(specs);
    }

    @GetMapping("/instruments")
    public AjaxResult getInstrumentList() {
        Map<String, Object> instruments = new HashMap<>();
        instruments.put("thermal", "热红外成像仪");
        instruments.put("lowLight", "微光成像仪");
        instruments.put("multiSpectral", "多谱段成像仪");
        return AjaxResult.success(instruments);
    }

    @GetMapping("/applications")
    public AjaxResult getApplicationAreaList() {
        Map<String, Object> applications = new HashMap<>();
        applications.put("climateChange", "气候变化");
        applications.put("ecology", "生态环境");
        applications.put("agriculture", "农业发展");
        applications.put("urbanDevelopment", "城市发展");
        applications.put("disaster", "灾害监测");
        applications.put("cooperation", "国际合作");
        return AjaxResult.success(applications);
    }

    @GetMapping("/data-service")
    public AjaxResult getDataServiceInfo() {
        Map<String, Object> dataService = new HashMap<>();
        dataService.put("scenes", "100万+");
        dataService.put("downloads", "50万+");
        dataService.put("partners", "100+");
        dataService.put("projects", "50+");
        return AjaxResult.success(dataService);
    }

    @GetMapping("/achievements")
    public AjaxResult getAchievementList() {
        List<SysSdgsat1Case> list = sdgsat1CaseService.selectSysSdgsat1CaseList(new SysSdgsat1Case());
        return AjaxResult.success(list);
    }
}
