package tech.easyflow.datacenter.meta.service;

import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService;
import tech.easyflow.common.entity.LoginAccount;
import tech.easyflow.datacenter.entity.DatacenterTable;
import tech.easyflow.datacenter.execution.model.DatacenterConnectionTestResult;
import tech.easyflow.datacenter.meta.entity.DatacenterSource;
import tech.easyflow.datacenter.meta.model.DatacenterBatchRegisterRequest;
import tech.easyflow.datacenter.meta.model.DatacenterCatalogMeta;
import tech.easyflow.datacenter.meta.model.DatacenterTableDetailMeta;

import java.math.BigInteger;
import java.util.List;

public interface DatacenterSourceService extends IService<DatacenterSource> {
    DatacenterSource saveSource(DatacenterSource source, LoginAccount account);

    Page<DatacenterSource> pageSources(Long pageNumber, Long pageSize, LoginAccount account);

    DatacenterConnectionTestResult testConnection(DatacenterSource source, LoginAccount account);

    List<DatacenterCatalogMeta> listCatalogs(BigInteger sourceId, LoginAccount account);

    List<DatacenterTable> listTables(BigInteger sourceId, String catalogName, LoginAccount account);

    DatacenterTableDetailMeta getTableDetail(BigInteger sourceId, String catalogName, String tableName, boolean register, LoginAccount account);

    List<DatacenterTable> batchRegisterTables(DatacenterBatchRegisterRequest request, LoginAccount account);

    void removeSource(BigInteger sourceId, LoginAccount account);
}
