package com.zcloud.personnel.positioning.service;

import com.zcloud.personnel.positioning.api.OpenapiConfigServiceI;
import com.zcloud.personnel.positioning.command.OpenapiConfigAddExe;
import com.zcloud.personnel.positioning.command.OpenapiConfigRemoveExe;
import com.zcloud.personnel.positioning.command.OpenapiConfigUpdateExe;
import com.zcloud.personnel.positioning.command.query.OpenapiConfigQueryExe;
import com.zcloud.personnel.positioning.dto.OpenapiConfigAddCmd;
import com.zcloud.personnel.positioning.dto.OpenapiConfigPageQry;
import com.zcloud.personnel.positioning.dto.OpenapiConfigUpdateCmd;
import com.zcloud.personnel.positioning.dto.clientobject.OpenapiConfigCO;
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 OpenapiConfigServiceImpl implements OpenapiConfigServiceI {
    private final OpenapiConfigAddExe openapiConfigAddExe;
    private final OpenapiConfigUpdateExe openapiConfigUpdateExe;
    private final OpenapiConfigRemoveExe openapiConfigRemoveExe;
    private final OpenapiConfigQueryExe openapiConfigQueryExe;

    @Override
    public PageResponse<OpenapiConfigCO> listPage(OpenapiConfigPageQry qry) {
        return openapiConfigQueryExe.execute(qry);
    }

    @Override
    public List<OpenapiConfigCO> listAll() {
        return openapiConfigQueryExe.listAll();
    }

    @Override
    public OpenapiConfigCO queryById(Long id) {
        return openapiConfigQueryExe.queryById(id);
    }

    @Override
    public SingleResponse<OpenapiConfigCO> add(OpenapiConfigAddCmd cmd) {
        openapiConfigAddExe.execute(cmd);
        return SingleResponse.buildSuccess();
    }

    @Override
    public void edit(OpenapiConfigUpdateCmd cmd) {
        openapiConfigUpdateExe.execute(cmd);
    }

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

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