package com.zcloud.domain.service;

import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.SingleResponse;
import com.zcloud.domain.api.DomainDepartmentServiceI;
import com.zcloud.domain.command.DomainDepartmentAddExe;
import com.zcloud.domain.command.DomainDepartmentRemoveExe;
import com.zcloud.domain.command.DomainDepartmentUpdateExe;
import com.zcloud.domain.command.query.DomainDepartmentQueryExe;
import com.zcloud.domain.dto.DomainDepartmentAddCmd;
import com.zcloud.domain.dto.DomainDepartmentPageQry;
import com.zcloud.domain.dto.DomainDepartmentUpdateCmd;
import com.zcloud.domain.dto.clientobject.DomainDepartmentCO;
import com.zcloud.domain.dto.clientobject.DomainDepartmentListCO;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

/**
 * web-app
 *
 * @Author zhaokai
 * @Date 2026-01-27 11:28:52
 */
@Service
@AllArgsConstructor
public class DomainDepartmentServiceImpl implements DomainDepartmentServiceI {
    private final DomainDepartmentAddExe domainDepartmentAddExe;
    private final DomainDepartmentUpdateExe domainDepartmentUpdateExe;
    private final DomainDepartmentRemoveExe domainDepartmentRemoveExe;
    private final DomainDepartmentQueryExe domainDepartmentQueryExe;

    @Override
    public PageResponse<DomainDepartmentListCO> listPage(DomainDepartmentPageQry qry) {

        return domainDepartmentQueryExe.execute(qry);
    }

    @Override
    public SingleResponse add(DomainDepartmentAddCmd cmd) {

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

    @Override
    public void edit(DomainDepartmentUpdateCmd domainDepartmentUpdateCmd) {
        domainDepartmentUpdateExe.execute(domainDepartmentUpdateCmd);
    }

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

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

    @Override
    public DomainDepartmentCO getInfoById(Long id) {
        return domainDepartmentQueryExe.getInfoById(id);
    }

    @Override
    public List<DomainDepartmentCO> listAll() {
        return domainDepartmentQueryExe.listAll();
    }
}

