package com.zcloud.primeport.service;

import com.alibaba.cola.dto.MultiResponse;
import com.zcloud.primeport.api.ClosedAreaServiceI;
import com.zcloud.primeport.command.ClosedAreaAddExe;
import com.zcloud.primeport.command.ClosedAreaRemoveExe;
import com.zcloud.primeport.command.ClosedAreaUpdateExe;
import com.zcloud.primeport.command.query.ClosedAreaCountExe;
import com.zcloud.primeport.command.query.ClosedAreaQueryExe;
import com.zcloud.primeport.dto.ClosedAreaAddCmd;
import com.zcloud.primeport.dto.ClosedAreaCountCmd;
import com.zcloud.primeport.dto.ClosedAreaPageQry;
import com.zcloud.primeport.dto.ClosedAreaUpdateCmd;
import com.zcloud.primeport.dto.clientobject.ClosedAreaCO;

import com.alibaba.cola.dto.PageResponse;
import com.alibaba.cola.dto.SingleResponse;
import com.zcloud.primeport.dto.clientobject.ClosedAreaCountCO;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * web-app
 *
 * @Author dearLin
 * @Date 2026-03-19 10:27:51
 */
@Service
@AllArgsConstructor
public class ClosedAreaServiceImpl implements ClosedAreaServiceI {
    private final ClosedAreaAddExe closedAreaAddExe;
    private final ClosedAreaUpdateExe closedAreaUpdateExe;
    private final ClosedAreaRemoveExe closedAreaRemoveExe;
    private final ClosedAreaQueryExe closedAreaQueryExe;
    private final ClosedAreaCountExe closedAreaCountExe;

    @Override
    public ClosedAreaCO queryById(Long id) {
        return closedAreaQueryExe.queryById(id);
    }

    @Override
    public PageResponse<ClosedAreaCO> listPage(ClosedAreaPageQry qry) {

        return closedAreaQueryExe.execute(qry);
    }

    @Override
    public SingleResponse add(ClosedAreaAddCmd cmd) {

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

    @Override
    public void edit(ClosedAreaUpdateCmd closedAreaUpdateCmd) {
        closedAreaUpdateExe.execute(closedAreaUpdateCmd);
    }

    @Override
    public MultiResponse<ClosedAreaCountCO> count(ClosedAreaCountCmd cmd) {
        return closedAreaCountExe.execute(cmd);
    }


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

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

    @Override
    public MultiResponse<ClosedAreaCO> getCountByHgAuthArea() {
        List<ClosedAreaCO> dataList = closedAreaQueryExe.getCountByHgAuthArea();
        return MultiResponse.of(dataList);
    }

    @Override
    public MultiResponse<ClosedAreaCO> listAllByJurisdictionalCorpId(Long id) {
        List<ClosedAreaCO> dataList = closedAreaQueryExe.listAllByJurisdictionalCorpId(id);
        return MultiResponse.of(dataList);
    }

    @Override
    public MultiResponse<ClosedAreaCO> listTree(ClosedAreaPageQry qry) {
        return closedAreaQueryExe.listTree(qry);
    }

    @Override
    public MultiResponse<ClosedAreaCO> listAllByhgAuthArea(String hgAuthArea) {
        return closedAreaQueryExe.listAllByhgAuthArea(hgAuthArea);
    }
}

