package com.zcloud.domain.service;

import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.SingleResponse;
import com.zcloud.domain.api.DomainGroupServiceI;
import com.zcloud.domain.command.DomainGroupAddExe;
import com.zcloud.domain.command.DomainGroupRemoveExe;
import com.zcloud.domain.command.DomainGroupUpdateExe;
import com.zcloud.domain.command.query.DomainGroupQueryExe;
import com.zcloud.domain.dto.DomainGroupAddCmd;
import com.zcloud.domain.dto.DomainGroupPageQry;
import com.zcloud.domain.dto.DomainGroupQry;
import com.zcloud.domain.dto.DomainGroupUpdateCmd;
import com.zcloud.domain.dto.clientobject.DomainGroupCO;
import com.zcloud.domain.dto.clientobject.DomainGroupInfoCO;
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:29:28
 */
@Service
@AllArgsConstructor
public class DomainGroupServiceImpl implements DomainGroupServiceI {
    private final DomainGroupAddExe domainGroupAddExe;
    private final DomainGroupUpdateExe domainGroupUpdateExe;
    private final DomainGroupRemoveExe domainGroupRemoveExe;
    private final DomainGroupQueryExe domainGroupQueryExe;

    @Override
    public PageResponse<DomainGroupCO> listPage(DomainGroupPageQry qry) {
        return domainGroupQueryExe.execute(qry);
    }

    @Override
    public SingleResponse add(DomainGroupAddCmd cmd) {

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

    @Override
    public void edit(DomainGroupUpdateCmd domainGroupUpdateCmd) {
        domainGroupUpdateExe.execute(domainGroupUpdateCmd);
    }

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

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

    @Override
    public DomainGroupInfoCO getInfoById(Long id) {
        return domainGroupQueryExe.getInfoById(id);
    }

    @Override
    public List<DomainGroupCO> listAll(DomainGroupQry qry) {
        return domainGroupQueryExe.listAll(qry);
    }
}

