package com.zcloud.zcGbsServicer.service;

import com.zcloud.zcGbsServicer.api.RescueTeamServiceI;
import com.zcloud.zcGbsServicer.command.RescueTeamAddExe;
import com.zcloud.zcGbsServicer.command.RescueTeamRemoveExe;
import com.zcloud.zcGbsServicer.command.RescueTeamUpdateExe;
import com.zcloud.zcGbsServicer.command.query.RescueTeamQueryExe;
import com.zcloud.zcGbsServicer.dto.RescueTeamAddCmd;
import com.zcloud.zcGbsServicer.dto.RescueTeamNameCheckQry;
import com.zcloud.zcGbsServicer.dto.RescueTeamPageQry;
import com.zcloud.zcGbsServicer.dto.RescueTeamScreenQry;
import com.zcloud.zcGbsServicer.dto.RescueTeamUpdateCmd;
import com.zcloud.zcGbsServicer.dto.clientobject.RescueTeamCO;
import com.zcloud.zcGbsServicer.dto.clientobject.RescueTeamScreenCO;

import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.SingleResponse;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

/**
* web-app
* @Author makejava
* @Date 2026-01-21 17:23:00
*/
@Service
@AllArgsConstructor
public class RescueTeamServiceImpl implements RescueTeamServiceI {
    private final RescueTeamAddExe rescueTeamAddExe;
    private final RescueTeamUpdateExe rescueTeamUpdateExe;
    private final RescueTeamRemoveExe rescueTeamRemoveExe;
    private final RescueTeamQueryExe rescueTeamQueryExe;

    @Override
    public PageResponse<RescueTeamCO> listPage(RescueTeamPageQry qry){

        return rescueTeamQueryExe.execute(qry);
    }

    @Override
    public PageResponse<RescueTeamScreenCO> listScreen(RescueTeamScreenQry qry) {
        return rescueTeamQueryExe.listScreen(qry);
    }

    @Override
    public SingleResponse add(RescueTeamAddCmd cmd) {

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

    @Override
    public void edit(RescueTeamUpdateCmd rescueTeamUpdateCmd) {
        rescueTeamUpdateExe.execute(rescueTeamUpdateCmd);
    }

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

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

    @Override
    public RescueTeamCO get(Long id) {
        return rescueTeamQueryExe.getById(id);
    }

    @Override
    public SingleResponse<Boolean> checkName(RescueTeamNameCheckQry qry) {
        return SingleResponse.of(rescueTeamQueryExe.checkName(qry));
    }
}

