package com.hdkj.lt.si.feign;

import com.hdkj.lt.core.bizms.modle.dto.StateEstimation;
import com.hdkj.lt.core.bizms.modle.po.FhzgFeederAutoSwitchMapping;
import com.hdkj.lt.core.bizms.modle.request.StateEstimationEquipRequest;
import com.hdkj.lt.core.bizms.modle.request.StateEstimationRequest;
import com.hdkj.lt.feign.IStateEstimationApiClient;
import com.hdkj.lt.si.service.estimation.StateEstimationService;
import com.hdkj.hussar.ApiResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;


import javax.validation.Valid;
import java.util.List;

/**
 * @Description
 * @Author wcx
 * @Date 2025/5/28 17:24
 * @Version 1.0
 */
@Slf4j
@RestController
@RequiredArgsConstructor
public class StateEstimationApiClient implements IStateEstimationApiClient {

    private final StateEstimationService stateEstimationService;

    @PostMapping(value = "feign/stateEstimation/queryPeriodByEquip")
    public ApiResponse<StateEstimation> queryPeriodByEquip(@RequestBody StateEstimationEquipRequest request) {
        return ApiResponse.success(stateEstimationService.queryPeriodByEquip(request));
    }

    @PostMapping("feign/stateEstimation/queryByFeederSave")
    public ApiResponse<StateEstimation> queryByFeederSave(@Valid @RequestBody StateEstimationRequest request) {
        return ApiResponse.success(stateEstimationService.queryByFeederSave(request));
    }

    @Override
    public ApiResponse<List<FhzgFeederAutoSwitchMapping>> saveAutoSwitch(StateEstimationRequest request) {
        return ApiResponse.success(stateEstimationService.saveAutoSwitch(request));
    }
}
