package com.zcloud.personnel.positioning.service;

import com.zcloud.personnel.positioning.api.SyncTaskServiceI;
import com.zcloud.personnel.positioning.command.SyncTaskAddExe;
import com.zcloud.personnel.positioning.command.SyncTaskRemoveExe;
import com.zcloud.personnel.positioning.command.SyncTaskUpdateExe;
import com.zcloud.personnel.positioning.command.query.SyncTaskQueryExe;
import com.zcloud.personnel.positioning.dto.SyncTaskAddCmd;
import com.zcloud.personnel.positioning.dto.SyncTaskPageQry;
import com.zcloud.personnel.positioning.dto.SyncTaskUpdateCmd;
import com.zcloud.personnel.positioning.dto.clientobject.SyncTaskCO;
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 SyncTaskServiceImpl implements SyncTaskServiceI {
    private final SyncTaskAddExe syncTaskAddExe;
    private final SyncTaskUpdateExe syncTaskUpdateExe;
    private final SyncTaskRemoveExe syncTaskRemoveExe;
    private final SyncTaskQueryExe syncTaskQueryExe;

    @Override
    public PageResponse<SyncTaskCO> listPage(SyncTaskPageQry qry) {
        return syncTaskQueryExe.execute(qry);
    }

    @Override
    public List<SyncTaskCO> listAll() {
        return syncTaskQueryExe.listAll();
    }

    @Override
    public SyncTaskCO queryById(Long id) {
        return syncTaskQueryExe.queryById(id);
    }

    @Override
    public SingleResponse<SyncTaskCO> add(SyncTaskAddCmd cmd) {
        syncTaskAddExe.execute(cmd);
        return SingleResponse.buildSuccess();
    }

    @Override
    public void edit(SyncTaskUpdateCmd cmd) {
        syncTaskUpdateExe.execute(cmd);
    }

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

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