package com.zcloud.domain.service;

import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.SingleResponse;
import com.zcloud.domain.api.ProjectTaskServiceI;
import com.zcloud.domain.command.ProjectTaskAddExe;
import com.zcloud.domain.command.ProjectTaskRemoveExe;
import com.zcloud.domain.command.ProjectTaskUpdateExe;
import com.zcloud.domain.command.query.ProjectTaskQueryExe;
import com.zcloud.domain.dto.ProjectTaskAddCmd;
import com.zcloud.domain.dto.ProjectTaskPageQry;
import com.zcloud.domain.dto.ProjectTaskUpdateCmd;
import com.zcloud.domain.dto.clientobject.ProjectTaskCO;
import com.zcloud.domain.dto.clientobject.ProjectTaskDetailsCO;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * web-app
 *
 * @Author zhaokai
 * @Date 2026-01-29 11:28:41
 */
@Service
@AllArgsConstructor
public class ProjectTaskServiceImpl implements ProjectTaskServiceI {
    private final ProjectTaskAddExe projectTaskAddExe;
    private final ProjectTaskUpdateExe projectTaskUpdateExe;
    private final ProjectTaskRemoveExe projectTaskRemoveExe;
    private final ProjectTaskQueryExe projectTaskQueryExe;

    @Override
    public PageResponse<ProjectTaskCO> listPage(ProjectTaskPageQry qry) {

        return projectTaskQueryExe.execute(qry);
    }

    @Override
    public SingleResponse add(ProjectTaskAddCmd cmd) {

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

    @Override
    public void edit(ProjectTaskUpdateCmd projectTaskUpdateCmd) {
        projectTaskUpdateExe.execute(projectTaskUpdateCmd);
    }

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

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

    @Override
    public ProjectTaskDetailsCO getInfoById(Long id) {
        return projectTaskQueryExe.getInfoById(id);
    }

    @Override
    public void updatExecuteStatusJob() {
        projectTaskUpdateExe.updatExecuteStatusJob();
    }
}

