package com.zcloud.fire.check.service;

import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.SingleResponse;
import com.zcloud.fire.check.api.FireDeviceServiceI;
import com.zcloud.fire.check.command.FireDeviceAddExe;
import com.zcloud.fire.check.command.FireDeviceRemoveExe;
import com.zcloud.fire.check.command.FireDeviceUpdateExe;
import com.zcloud.fire.check.command.query.FireDeviceQueryExe;
import com.zcloud.fire.check.dto.*;
import com.zcloud.fire.check.dto.clientobject.CorpStatisticsCO;
import com.zcloud.fire.check.dto.clientobject.FireDeviceCO;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.Collection;

/**
 * web-app
 *
 * @Author zhaokai
 * @Date 2025-11-26 10:12:35
 */
@Service
@AllArgsConstructor
public class FireDeviceServiceImpl implements FireDeviceServiceI {
    private final FireDeviceAddExe fireDeviceAddExe;
    private final FireDeviceUpdateExe fireDeviceUpdateExe;
    private final FireDeviceRemoveExe fireDeviceRemoveExe;
    private final FireDeviceQueryExe fireDeviceQueryExe;

    @Override
    public PageResponse<FireDeviceCO> listPage(FireDevicePageQry qry) {

        return fireDeviceQueryExe.execute(qry);
    }

    @Override
    public SingleResponse add(FireDeviceAddCmd cmd) {

        fireDeviceAddExe.execute(cmd);
        return SingleResponse.buildSuccess();
    }

    @Override
    public void edit(FireDeviceUpdateCmd fireDeviceUpdateCmd) {
        fireDeviceUpdateExe.execute(fireDeviceUpdateCmd);
    }

    @Override
    public void remove(Long id) {
        fireDeviceRemoveExe.execute(id);
    }

    @Override
    public void removeBatch(Long[] ids) {
        fireDeviceRemoveExe.execute(ids);
    }

    @Override
    public FireDeviceCO getInfoById(Long id) {
        return fireDeviceQueryExe.getInfoById(id);
    }

    @Override
    public void exportFireDevicePage(Long[] ids, HttpServletResponse httpServletResponse) {
        fireDeviceQueryExe.exportFireDevicePage(ids, httpServletResponse);
    }

    @Override
    public void importFireDevicePage(MultipartFile file) {
        fireDeviceQueryExe.importFireDevicePage(file);
    }

    @Override
    public Collection<FireDeviceCO> getAllList(FireDeviceListQry qry) {
        return fireDeviceQueryExe.getAllList(qry);
    }

    @Override
    public PageResponse<CorpStatisticsCO> corpStatisticslist(CorpStatisticsPageQry qry) {
        return fireDeviceQueryExe.corpStatisticslist(qry);
    }

    @Override
    public PageResponse<FireDeviceCO> pageByPointId(FireDevicePageQry qry) {
        return fireDeviceQueryExe.pageByPointId(qry);
    }

    @Override
    public void deviceOverTimeMessage() {
         fireDeviceQueryExe.deviceOverTimeMessage();
    }
}

