package com.njcn.gather.systemops.database.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.gather.systemops.database.pojo.param.DatabaseConnectionParam;
import com.njcn.gather.systemops.database.pojo.po.DatabaseConnection;
import com.njcn.gather.systemops.database.pojo.vo.DatabaseConnectionVO;
import com.njcn.gather.systemops.database.pojo.vo.DatabaseTableVO;
import com.njcn.gather.systemops.database.pojo.vo.DatabaseTestResultVO;

import java.util.List;

/**
 * 数据库连接配置服务。
 */
public interface DatabaseConnectionService extends IService<DatabaseConnection> {

    Page<DatabaseConnectionVO> listConnections(DatabaseConnectionParam.QueryParam queryParam);

    boolean addConnection(DatabaseConnectionParam param);

    boolean updateConnection(DatabaseConnectionParam.UpdateParam param);

    boolean deleteConnection(DatabaseConnectionParam.DeleteParam param);

    DatabaseTestResultVO testConnection(DatabaseConnectionParam.TestParam param);

    List<DatabaseTableVO> listTables(DatabaseConnectionParam.TablesParam param);

    DatabaseConnection requireEnabled(String connectionId);

    String resolvePassword(DatabaseConnection connection, String temporaryPassword);
}
