package com.zcloud.fire.check.service;

import com.alibaba.cola.dto.MultiResponse;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.SingleResponse;
import com.zcloud.fire.check.api.FirePointServiceI;
import com.zcloud.fire.check.command.FirePointAddExe;
import com.zcloud.fire.check.command.FirePointRemoveExe;
import com.zcloud.fire.check.command.FirePointUpdateExe;
import com.zcloud.fire.check.command.query.FirePointQueryExe;
import com.zcloud.fire.check.dto.FirePointAddCmd;
import com.zcloud.fire.check.dto.FirePointDeviceQry;
import com.zcloud.fire.check.dto.FirePointPageQry;
import com.zcloud.fire.check.dto.FirePointUpdateCmd;
import com.zcloud.fire.check.dto.FirePointUpdateDepartmentCmd;
import com.zcloud.fire.check.dto.clientobject.FirePointCO;
import com.zcloud.fire.check.dto.clientobject.FirePointDeviceCO;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletResponse;

/**
 * web-app
 *
 * @Author zhaokai
 * @Date 2025-11-26 10:12:55
 */
@Service
@AllArgsConstructor
public class FirePointServiceImpl implements FirePointServiceI {
    private final FirePointAddExe firePointAddExe;
    private final FirePointUpdateExe firePointUpdateExe;
    private final FirePointRemoveExe firePointRemoveExe;
    private final FirePointQueryExe firePointQueryExe;

    @Override
    public PageResponse<FirePointCO> listPage(FirePointPageQry qry) {

        return firePointQueryExe.execute(qry);
    }

    @Override
    public SingleResponse add(FirePointAddCmd cmd) {
        firePointAddExe.execute(cmd);
        return SingleResponse.buildSuccess();
    }

    @Override
    public void edit(FirePointUpdateCmd firePointUpdateCmd) {
        firePointUpdateExe.execute(firePointUpdateCmd);
    }

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

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

    @Override
    public FirePointCO getInfoById(Long id) {
        return firePointQueryExe.getInfoById(id);
    }

    @Override
    public void editAllDepartment(FirePointUpdateDepartmentCmd firePointUpdateDepartmentCmd) {
        firePointUpdateExe.editAllDepartment(firePointUpdateDepartmentCmd);
    }

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

    @Override
    public MultiResponse<FirePointCO> listByFireRegionId(String fireRegionId) {
        return firePointQueryExe.listByFireRegionId(fireRegionId);

    }

    @Override
    public PageResponse<FirePointDeviceCO> listDevice(FirePointDeviceQry qry) {
        return firePointQueryExe.listDevice(qry);
    }
}

