/* Generated by camel build tools - do NOT edit this file! */
package org.apache.camel.component.dhis2;

import javax.annotation.processing.Generated;
import java.util.Map;

import org.apache.camel.CamelContext;
import org.apache.camel.spi.ExtendedPropertyConfigurerGetter;
import org.apache.camel.spi.PropertyConfigurerGetter;
import org.apache.camel.spi.ConfigurerStrategy;
import org.apache.camel.spi.GeneratedPropertyConfigurer;
import org.apache.camel.util.CaseInsensitiveMap;
import org.apache.camel.support.component.PropertyConfigurerSupport;

/**
 * Generated by camel build tools - do NOT edit this file!
 */
@Generated("org.apache.camel.maven.packaging.EndpointSchemaGeneratorMojo")
@SuppressWarnings("unchecked")
public class Dhis2ComponentConfigurer extends PropertyConfigurerSupport implements GeneratedPropertyConfigurer, ExtendedPropertyConfigurerGetter {

    private static final Map<String, Object> ALL_OPTIONS;
    static {
        Map<String, Object> map = new CaseInsensitiveMap();
        map.put("BaseApiUrl", java.lang.String.class);
        map.put("BridgeErrorHandler", boolean.class);
        map.put("LazyStartProducer", boolean.class);
        map.put("AutowiredEnabled", boolean.class);
        map.put("Client", org.hisp.dhis.integration.sdk.api.Dhis2Client.class);
        map.put("Configuration", org.apache.camel.component.dhis2.Dhis2Configuration.class);
        map.put("Password", java.lang.String.class);
        map.put("PersonalAccessToken", java.lang.String.class);
        map.put("Username", java.lang.String.class);
        ALL_OPTIONS = map;
    }

    private org.apache.camel.component.dhis2.Dhis2Configuration getOrCreateConfiguration(Dhis2Component target) {
        if (target.getConfiguration() == null) {
            target.setConfiguration(new org.apache.camel.component.dhis2.Dhis2Configuration());
        }
        return target.getConfiguration();
    }

    @Override
    public boolean configure(CamelContext camelContext, Object obj, String name, Object value, boolean ignoreCase) {
        Dhis2Component target = (Dhis2Component) obj;
        switch (ignoreCase ? name.toLowerCase() : name) {
        case "autowiredenabled":
        case "autowiredEnabled": target.setAutowiredEnabled(property(camelContext, boolean.class, value)); return true;
        case "baseapiurl":
        case "baseApiUrl": getOrCreateConfiguration(target).setBaseApiUrl(property(camelContext, java.lang.String.class, value)); return true;
        case "bridgeerrorhandler":
        case "bridgeErrorHandler": target.setBridgeErrorHandler(property(camelContext, boolean.class, value)); return true;
        case "client": getOrCreateConfiguration(target).setClient(property(camelContext, org.hisp.dhis.integration.sdk.api.Dhis2Client.class, value)); return true;
        case "configuration": target.setConfiguration(property(camelContext, org.apache.camel.component.dhis2.Dhis2Configuration.class, value)); return true;
        case "lazystartproducer":
        case "lazyStartProducer": target.setLazyStartProducer(property(camelContext, boolean.class, value)); return true;
        case "password": getOrCreateConfiguration(target).setPassword(property(camelContext, java.lang.String.class, value)); return true;
        case "personalaccesstoken":
        case "personalAccessToken": getOrCreateConfiguration(target).setPersonalAccessToken(property(camelContext, java.lang.String.class, value)); return true;
        case "username": getOrCreateConfiguration(target).setUsername(property(camelContext, java.lang.String.class, value)); return true;
        default: return false;
        }
    }

    @Override
    public Map<String, Object> getAllOptions(Object target) {
        return ALL_OPTIONS;
    }

    @Override
    public Class<?> getOptionType(String name, boolean ignoreCase) {
        switch (ignoreCase ? name.toLowerCase() : name) {
        case "autowiredenabled":
        case "autowiredEnabled": return boolean.class;
        case "baseapiurl":
        case "baseApiUrl": return java.lang.String.class;
        case "bridgeerrorhandler":
        case "bridgeErrorHandler": return boolean.class;
        case "client": return org.hisp.dhis.integration.sdk.api.Dhis2Client.class;
        case "configuration": return org.apache.camel.component.dhis2.Dhis2Configuration.class;
        case "lazystartproducer":
        case "lazyStartProducer": return boolean.class;
        case "password": return java.lang.String.class;
        case "personalaccesstoken":
        case "personalAccessToken": return java.lang.String.class;
        case "username": return java.lang.String.class;
        default: return null;
        }
    }

    @Override
    public Object getOptionValue(Object obj, String name, boolean ignoreCase) {
        Dhis2Component target = (Dhis2Component) obj;
        switch (ignoreCase ? name.toLowerCase() : name) {
        case "autowiredenabled":
        case "autowiredEnabled": return target.isAutowiredEnabled();
        case "baseapiurl":
        case "baseApiUrl": return getOrCreateConfiguration(target).getBaseApiUrl();
        case "bridgeerrorhandler":
        case "bridgeErrorHandler": return target.isBridgeErrorHandler();
        case "client": return getOrCreateConfiguration(target).getClient();
        case "configuration": return target.getConfiguration();
        case "lazystartproducer":
        case "lazyStartProducer": return target.isLazyStartProducer();
        case "password": return getOrCreateConfiguration(target).getPassword();
        case "personalaccesstoken":
        case "personalAccessToken": return getOrCreateConfiguration(target).getPersonalAccessToken();
        case "username": return getOrCreateConfiguration(target).getUsername();
        default: return null;
        }
    }
}

