package com.l7tech.gateway.api;

import com.l7tech.gateway.api.impl.AccessorSupport;
import com.l7tech.gateway.api.impl.AttributeExtensibleType;
import com.l7tech.gateway.api.impl.ElementExtensionSupport;
import com.l7tech.gateway.api.impl.PropertiesMapType;
import jakarta.xml.bind.annotation.XmlAnyElement;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlType;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.List;
import java.util.Map;

@XmlRootElement(name = "JDBCConnection")
@XmlType(name = "JDBCConnectionType", propOrder = {"nameValue", "enabledValue", "properties", "jdbcExtension", "extensions"})
@AccessorSupport.AccessibleResource(name = "jdbcConnections")
public class JDBCConnectionMO extends SecurityZoneableObject {
   private AttributeExtensibleType.AttributeExtensibleString h;
   private AttributeExtensibleType.AttributeExtensibleBoolean i = new AttributeExtensibleType.AttributeExtensibleBoolean(false);
   private Map<String, Object> j;
   private JDBCConnectionMO.JdbcExtension k = new JDBCConnectionMO.JdbcExtension();

   public String getName() {
      return AttributeExtensibleType.get(this.h);
   }

   public void setName(String var1) {
      this.h = AttributeExtensibleType.set(this.h, var1);
   }

   public boolean isEnabled() {
      return AttributeExtensibleType.get(this.i, false);
   }

   public void setEnabled(boolean var1) {
      this.i = AttributeExtensibleType.set(this.i, var1);
   }

   public String getDriverClass() {
      return AttributeExtensibleType.get(this.k.d);
   }

   public void setDriverClass(String var1) {
      this.k.d = AttributeExtensibleType.set(this.k.d, var1);
   }

   public String getJdbcUrl() {
      return AttributeExtensibleType.get(this.k.e);
   }

   public void setJdbcUrl(String var1) {
      this.k.e = AttributeExtensibleType.set(this.k.e, var1);
   }

   public Map<String, Object> getConnectionProperties() {
      return this.k.f;
   }

   public void setConnectionProperties(Map<String, Object> var1) {
      this.k.f = var1;
   }

   @XmlElement(name = "Properties")
   @XmlJavaTypeAdapter(PropertiesMapType.PropertiesMapTypeAdapter.class)
   public Map<String, Object> getProperties() {
      return this.j;
   }

   public void setProperties(Map<String, Object> var1) {
      this.j = var1;
   }

   @XmlElement(name = "Name", required = true)
   protected AttributeExtensibleType.AttributeExtensibleString getNameValue() {
      return this.h;
   }

   protected void setNameValue(AttributeExtensibleType.AttributeExtensibleString var1) {
      this.h = var1;
   }

   @XmlElement(name = "Enabled", required = true)
   protected AttributeExtensibleType.AttributeExtensibleBoolean getEnabledValue() {
      return this.i;
   }

   protected void setEnabledValue(AttributeExtensibleType.AttributeExtensibleBoolean var1) {
      this.i = var1;
   }

   @XmlElement(name = "Extension")
   protected JDBCConnectionMO.JdbcExtension getJdbcExtension() {
      return this.k;
   }

   protected void setJdbcExtension(JDBCConnectionMO.JdbcExtension var1) {
      this.k = var1 == null ? new JDBCConnectionMO.JdbcExtension() : var1;
   }

   @XmlAnyElement(lax = true)
   @Override
   protected List<Object> getExtensions() {
      return super.getExtensions();
   }

   JDBCConnectionMO() {
   }

   @XmlType(name = "JdbcExtensionType", propOrder = {"driverClass", "jdbcUrl", "connectionProperties", "extension", "extensions"})
   protected static class JdbcExtension extends ElementExtensionSupport {
      private AttributeExtensibleType.AttributeExtensibleString d;
      private AttributeExtensibleType.AttributeExtensibleString e;
      private Map<String, Object> f;

      @XmlElement(name = "DriverClass", required = true)
      protected AttributeExtensibleType.AttributeExtensibleString getDriverClass() {
         return this.d;
      }

      protected void setDriverClass(AttributeExtensibleType.AttributeExtensibleString var1) {
         this.d = var1;
      }

      @XmlElement(name = "JdbcUrl", required = true)
      protected AttributeExtensibleType.AttributeExtensibleString getJdbcUrl() {
         return this.e;
      }

      protected void setJdbcUrl(AttributeExtensibleType.AttributeExtensibleString var1) {
         this.e = var1;
      }

      @XmlElement(name = "ConnectionProperties")
      @XmlJavaTypeAdapter(PropertiesMapType.PropertiesMapTypeAdapter.class)
      public Map<String, Object> getConnectionProperties() {
         return this.f;
      }

      public void setConnectionProperties(Map<String, Object> var1) {
         this.f = var1;
      }
   }
}
