package com.zcloud.personnel.positioning.service;

import com.zcloud.personnel.positioning.api.AreaServiceI;
import com.zcloud.personnel.positioning.command.AreaAddExe;
import com.zcloud.personnel.positioning.command.AreaRemoveExe;
import com.zcloud.personnel.positioning.command.AreaUpdateExe;
import com.zcloud.personnel.positioning.command.query.AreaQueryExe;
import com.zcloud.personnel.positioning.dto.AreaAddCmd;
import com.zcloud.personnel.positioning.dto.AreaPageQry;
import com.zcloud.personnel.positioning.dto.AreaUpdateCmd;
import com.zcloud.personnel.positioning.dto.clientobject.AreaCO;
import com.zcloud.personnel.positioning.dto.clientobject.AreaPersonStatCO;
import com.zcloud.personnel.positioning.dto.clientobject.OptionCO;
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 AreaServiceImpl implements AreaServiceI {
    private final AreaAddExe areaAddExe;
    private final AreaUpdateExe areaUpdateExe;
    private final AreaRemoveExe areaRemoveExe;
    private final AreaQueryExe areaQueryExe;

    @Override
    public PageResponse<AreaCO> listPage(AreaPageQry qry) {
        return areaQueryExe.execute(qry);
    }

    @Override
    public List<AreaCO> listAll() {
        return areaQueryExe.listAll();
    }

    @Override
    public List<OptionCO> listOptions(String corpinfoId, String keyword) {
        return areaQueryExe.listOptions(corpinfoId, keyword);
    }

    @Override
    public List<AreaPersonStatCO> listPersonStat(Long corpinfoId) {
        return areaQueryExe.listPersonStat(corpinfoId);
    }

    @Override
    public AreaCO queryById(Long id) {
        return areaQueryExe.queryById(id);
    }

    @Override
    public SingleResponse<AreaCO> add(AreaAddCmd cmd) {
        areaAddExe.execute(cmd);
        return SingleResponse.buildSuccess();
    }

    @Override
    public void edit(AreaUpdateCmd cmd) {
        areaUpdateExe.execute(cmd);
    }

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

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