/*
 * Copyright 2025 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.openehealth.ipf.platform.camel.ihe.svs.core.converters;

import org.apache.camel.TypeConverterLoaderException;
import org.apache.camel.spi.TypeConverterLoader;
import org.apache.camel.spi.TypeConverterRegistry;
import org.apache.camel.support.SimpleTypeConverter;

/**
 * Generated by camel build tools - do NOT edit this file!
 */
public final class SvsConvertersLoader implements TypeConverterLoader {

    public SvsConvertersLoader() {
    }

    @Override
    public void load(TypeConverterRegistry registry) throws TypeConverterLoaderException {
        registerConverters(registry);
    }

    private void registerConverters(TypeConverterRegistry registry) {
        addTypeConverter(registry, java.lang.String.class, org.openehealth.ipf.commons.ihe.svs.core.requests.RetrieveValueSetRequest.class, false,
                         (type, exchange, value) -> org.openehealth.ipf.platform.camel.ihe.svs.core.converters.SvsConverters.svsQueryToXml((org.openehealth.ipf.commons.ihe.svs.core.requests.RetrieveValueSetRequest) value));
        addTypeConverter(registry, java.io.InputStream.class, org.openehealth.ipf.commons.ihe.svs.core.requests.RetrieveValueSetRequest.class, false,
                         (type, exchange, value) -> org.openehealth.ipf.platform.camel.ihe.svs.core.converters.SvsConverters.svsQueryToInputStream((org.openehealth.ipf.commons.ihe.svs.core.requests.RetrieveValueSetRequest) value));
        addTypeConverter(registry, java.lang.String.class, org.openehealth.ipf.commons.ihe.svs.core.responses.RetrieveValueSetResponse.class, false,
                         (type, exchange, value) -> org.openehealth.ipf.platform.camel.ihe.svs.core.converters.SvsConverters.svsResponseToXml((org.openehealth.ipf.commons.ihe.svs.core.responses.RetrieveValueSetResponse) value));
        addTypeConverter(registry, org.openehealth.ipf.commons.ihe.svs.core.requests.RetrieveValueSetRequest.class, java.lang.String.class, false,
                         (type, exchange, value) -> org.openehealth.ipf.platform.camel.ihe.svs.core.converters.SvsConverters.xmlToSvsQuery((java.lang.String) value));
        addTypeConverter(registry, org.openehealth.ipf.commons.ihe.svs.core.responses.RetrieveValueSetResponse.class, java.lang.String.class, false,
                         (type, exchange, value) -> org.openehealth.ipf.platform.camel.ihe.svs.core.converters.SvsConverters.xmlToSvsResponse((java.lang.String) value));
    }

    private static void addTypeConverter(TypeConverterRegistry registry, Class<?> toType, Class<?> fromType, boolean allowNull, SimpleTypeConverter.ConversionMethod method) {
        registry.addTypeConverter(toType, fromType, new SimpleTypeConverter(allowNull, method));
    }

}