package com.l7tech.gateway.common.jdbc;

import com.l7tech.gateway.common.AsyncAdminMethods;
import com.l7tech.gateway.common.admin.Administrative;
import com.l7tech.gateway.common.security.rbac.MethodStereotype;
import com.l7tech.gateway.common.security.rbac.Secured;
import com.l7tech.objectmodel.DeleteException;
import com.l7tech.objectmodel.EntityType;
import com.l7tech.objectmodel.FindException;
import com.l7tech.objectmodel.Goid;
import com.l7tech.objectmodel.UpdateException;
import com.l7tech.util.ConfigFactory;
import java.util.List;
import org.jetbrains.annotations.Nullable;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
@Secured(types = EntityType.JDBC_CONNECTION)
@Administrative
public interface JdbcAdmin extends AsyncAdminMethods {
   String ORIGINAL_DRIVERCLASS_LIST = "com.mysql.cj.jdbc.Driver";
   int ORIGINAL_MAX_RECORDS = 10;
   int ORIGINAL_C3P0_BASIC_POOL_CONFIG_MINPOOLSIZE = 3;
   int ORIGINAL_C3P0_BASIC_POOL_CONFIG_MAXPOOLSIZE = 15;
   int MAX_QUERY_LENGTH = ConfigFactory.getIntProperty("com.l7tech.jdbcquery.maxquerylength", 4096);

   @Transactional(readOnly = true)
   @Secured(types = EntityType.JDBC_CONNECTION, stereotype = MethodStereotype.FIND_ENTITY)
   JdbcConnection getJdbcConnection(String var1) throws FindException;

   @Transactional(readOnly = true)
   @Secured(types = EntityType.JDBC_CONNECTION, stereotype = MethodStereotype.FIND_ENTITIES)
   List<JdbcConnection> getAllJdbcConnections() throws FindException;

   @Transactional(readOnly = true)
   @Secured(stereotype = MethodStereotype.UNCHECKED_WIDE_OPEN)
   List<String> getAllJdbcConnectionNames() throws FindException;

   @Secured(types = EntityType.JDBC_CONNECTION, stereotype = MethodStereotype.SAVE_OR_UPDATE)
   Goid saveJdbcConnection(JdbcConnection var1) throws UpdateException;

   @Secured(types = EntityType.JDBC_CONNECTION, stereotype = MethodStereotype.DELETE_ENTITY)
   void deleteJdbcConnection(JdbcConnection var1) throws DeleteException;

   @Transactional(readOnly = true)
   @Secured(types = EntityType.JDBC_CONNECTION, stereotype = MethodStereotype.TEST_CONFIGURATION)
   AsyncAdminMethods.JobId<String> testJdbcConnection(JdbcConnection var1);

   @Transactional(readOnly = true)
   @Secured(types = EntityType.JDBC_CONNECTION, stereotype = MethodStereotype.TEST_CONFIGURATION)
   AsyncAdminMethods.JobId<String> testJdbcQuery(String var1, String var2, @Nullable String var3, int var4);

   @Transactional(readOnly = true)
   @Secured(types = EntityType.JDBC_CONNECTION, stereotype = MethodStereotype.TEST_CONFIGURATION)
   String testJdbcQueryForAPI(String var1, String var2, @Nullable String var3, int var4);

   @Transactional(readOnly = true)
   @Secured(stereotype = MethodStereotype.UNCHECKED_WIDE_OPEN)
   List<String> getPropertyDefaultDriverClassList();

   @Transactional(readOnly = true)
   @Secured(stereotype = MethodStereotype.UNCHECKED_WIDE_OPEN)
   List<String> getPropertySupportedDriverClass();

   @Transactional(readOnly = true)
   @Secured(stereotype = MethodStereotype.UNCHECKED_WIDE_OPEN)
   int getPropertyDefaultMaxRecords();

   @Transactional(readOnly = true)
   @Secured(stereotype = MethodStereotype.UNCHECKED_WIDE_OPEN)
   int getPropertyDefaultMinPoolSize();

   @Transactional(readOnly = true)
   @Secured(stereotype = MethodStereotype.UNCHECKED_WIDE_OPEN)
   int getPropertyDefaultMaxPoolSize();

   @Transactional(readOnly = true)
   @Secured(stereotype = MethodStereotype.UNCHECKED_WIDE_OPEN)
   boolean isDriverClassSupported(String var1);
}
