package com.kym.admin.controller;

import com.kym.common.R;
import com.kym.entity.admin.EquipmentInfo;
import com.kym.entity.admin.queryParams.EquipmentQueryParam;
import com.kym.entity.common.PageBean;
import com.kym.service.admin.EquipmentInfoService;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 充电桩桩体设备 前端控制器
 * </p>
 *
 * @author skyline
 * @since 2023-08-05
 */
@RestController
@RequestMapping("/equipment")
public class EquipmentInfoController {

    private final EquipmentInfoService equipmentInfoService;

    public EquipmentInfoController(EquipmentInfoService equipmentInfoService) {
        this.equipmentInfoService = equipmentInfoService;
    }

    /**
     * 充电桩列表
     *
     * @param params
     * @return
     */
    @GetMapping("/listEquipment")
    R listEquipment(@ModelAttribute EquipmentQueryParam params) {
        PageBean<EquipmentInfo> res = equipmentInfoService.listEquipment(params);
        return R.success(res);
    }

    /**
     * 统计充电桩状态
     *
     * @return
     */
    @GetMapping("/statEquipmentStatus")
    R statEquipment(String stationId) {
        return R.success(equipmentInfoService.statEquipmentStatus(stationId));
    }

}
