package com.zcloud.personnel.positioning.service;

import com.zcloud.personnel.positioning.api.FencePointServiceI;
import com.zcloud.personnel.positioning.command.FencePointAddExe;
import com.zcloud.personnel.positioning.command.FencePointRemoveExe;
import com.zcloud.personnel.positioning.command.FencePointUpdateExe;
import com.zcloud.personnel.positioning.command.query.FencePointQueryExe;
import com.zcloud.personnel.positioning.dto.FencePointAddCmd;
import com.zcloud.personnel.positioning.dto.FencePointPageQry;
import com.zcloud.personnel.positioning.dto.FencePointUpdateCmd;
import com.zcloud.personnel.positioning.dto.clientobject.FencePointCO;
import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.SingleResponse;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * web-app
 *
 * @Author fangjiakai
 * @Date 2026-07-07
 */
@Service
@AllArgsConstructor
public class FencePointServiceImpl implements FencePointServiceI {
    private final FencePointAddExe fencePointAddExe;
    private final FencePointUpdateExe fencePointUpdateExe;
    private final FencePointRemoveExe fencePointRemoveExe;
    private final FencePointQueryExe fencePointQueryExe;

    @Override
    public PageResponse<FencePointCO> listPage(FencePointPageQry qry) {
        return fencePointQueryExe.execute(qry);
    }

    @Override
    public List<FencePointCO> listAll() {
        return fencePointQueryExe.listAll();
    }

    @Override
    public FencePointCO queryById(Long id) {
        return fencePointQueryExe.queryById(id);
    }

    @Override
    public SingleResponse<FencePointCO> add(FencePointAddCmd cmd) {
        fencePointAddExe.execute(cmd);
        return SingleResponse.buildSuccess();
    }

    @Override
    public void edit(FencePointUpdateCmd cmd) {
        fencePointUpdateExe.execute(cmd);
    }

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

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