// Path: identity-service/src/main/java/eu/nimble/core/infrastructure/identity/config/NimbleConfigurationProperties.java
// @Component
// @Configuration
// @EnableConfigurationProperties
// @ConfigurationProperties(prefix = "nimble")
// public class NimbleConfigurationProperties {
// 
//     private LanguageID defaultLanguageID = LanguageID.ENGLISH;
// 
//     public LanguageID getDefaultLanguageID() {
//         return defaultLanguageID;
//     }
// 
//     public void setDefaultLanguageID(String defaultLanguageID) {
//         this.defaultLanguageID = LanguageID.valueOf(defaultLanguageID);
//     }
// 
//     public enum LanguageID {
//         @JsonProperty("en")
//         ENGLISH("en"),
//         @JsonProperty("es")
//         SPANISH("es"),
//         @JsonProperty("de")
//         GERMAN("de"),
//         @JsonProperty("tr")
//         TURKISH("tr"),
//         @JsonProperty("sv")
//         SWEDISH("sv"),
//         @JsonProperty("it")
//         ITALIAN("it");
// 
//         private final String id;
// 
//         LanguageID(final String id) {
//             this.id = id;
//         }
// 
//         @Override
//         public String toString() {
//             return id;
//         }
// 
//         public static LanguageID fromString(String identifier) {
//             return Arrays.stream(LanguageID.values()).filter(l -> l.id.equals(identifier)).findFirst().orElse(null);
//         }
//     }
// }
// 
// Path: identity-service/src/main/java/eu/nimble/core/infrastructure/identity/entity/UaaUser.java
// @Entity
// public class UaaUser implements Serializable {
// 
//     @Id
//     @Column(nullable = false, unique = true)
//     private String externalID;
// 
//     private String username;
// 
//     @OneToOne
//     private PersonType ublPerson;
// 
//     @ColumnDefault("false")
//     private Boolean showWelcomeInfo = false;
// 
//     public UaaUser() {
//     }
// 
//     public UaaUser(String username, PersonType ublPerson, String externalID) {
//         this.username = username;
//         this.ublPerson = ublPerson;
//         this.externalID = externalID;
//         this.showWelcomeInfo = true;
//     }
// 
//     public String getUsername() {
//         return username;
//     }
// 
//     public String getExternalID() {
//         return externalID;
//     }
// 
//     public PersonType getUBLPerson() {
//         return this.ublPerson;
//     }
// 
//     public Boolean getShowWelcomeInfo() {
//         return showWelcomeInfo;
//     }
// 
//     public void setShowWelcomeInfo(Boolean showWelcomeInfo) {
//         this.showWelcomeInfo = showWelcomeInfo;
//     }
// }


import com.google.common.base.Strings;
import eu.nimble.core.infrastructure.identity.config.NimbleConfigurationProperties;
import eu.nimble.core.infrastructure.identity.entity.UaaUser;
import eu.nimble.core.infrastructure.identity.entity.dto.*;
import eu.nimble.service.model.ubl.commonaggregatecomponents.*;
import eu.nimble.service.model.ubl.commonbasiccomponents.BinaryObjectType;
import eu.nimble.service.model.ubl.commonbasiccomponents.CodeType;
import eu.nimble.service.model.ubl.commonbasiccomponents.QuantityType;
import eu.nimble.service.model.ubl.commonbasiccomponents.TextType;
import eu.nimble.service.model.ubl.extension.QualityIndicatorParameter;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;


        PaymentMeansType ublPaymentMeans = new PaymentMeansType();
        ublPaymentMeans.setInstructionNote(UblAdapter.adaptTextType(dtoPaymentMeans.getInstructionNote()));
        return ublPaymentMeans;
    }

    public static PaymentMeans adaptPaymentMeans(PaymentMeansType ublPaymentMeans) {

        if (ublPaymentMeans == null)
            return new PaymentMeans();

        PaymentMeans dtoPaymentMeans = new PaymentMeans();
        dtoPaymentMeans.setInstructionNote(UblAdapter.adaptTextType(ublPaymentMeans.getInstructionNote()));
        return dtoPaymentMeans;
    }

    public static PartyIdentificationType adaptPartyIdentifier(String identifier) {
        PartyIdentificationType partyIdentificationType = new PartyIdentificationType();
        partyIdentificationType.setID(identifier);
        return partyIdentificationType;
    }

    public static String adaptPartyIdentifier(PartyIdentificationType partyIdentification) {
        return partyIdentification.getID();
    }

    public static String adaptPartyIdentifier(PartyType partyType) {
        return adaptPartyIdentifier(Objects.requireNonNull(partyType.getPartyIdentification().stream().findFirst().orElse(null)));
    }


// Path: identity-service/src/main/java/eu/nimble/core/infrastructure/identity/config/NimbleConfigurationProperties.java
// @Component
// @Configuration
// @EnableConfigurationProperties
// @ConfigurationProperties(prefix = "nimble")
// public class NimbleConfigurationProperties {
// 
//     private LanguageID defaultLanguageID = LanguageID.ENGLISH;
// 
//     public LanguageID getDefaultLanguageID() {
//         return defaultLanguageID;
//     }
// 
//     public void setDefaultLanguageID(String defaultLanguageID) {
//         this.defaultLanguageID = LanguageID.valueOf(defaultLanguageID);
//     }
// 
//     public enum LanguageID {
//         @JsonProperty("en")
//         ENGLISH("en"),
//         @JsonProperty("es")
//         SPANISH("es"),
//         @JsonProperty("de")
//         GERMAN("de"),
//         @JsonProperty("tr")
//         TURKISH("tr"),
//         @JsonProperty("sv")
//         SWEDISH("sv"),
//         @JsonProperty("it")
//         ITALIAN("it");
// 
//         private final String id;
// 
//         LanguageID(final String id) {
//             this.id = id;
//         }
// 
//         @Override
//         public String toString() {
//             return id;
//         }
// 
//         public static LanguageID fromString(String identifier) {
//             return Arrays.stream(LanguageID.values()).filter(l -> l.id.equals(identifier)).findFirst().orElse(null);
//         }
//     }
// }
// 
// Path: identity-service/src/main/java/eu/nimble/core/infrastructure/identity/entity/UaaUser.java
// @Entity
// public class UaaUser implements Serializable {
// 
//     @Id
//     @Column(nullable = false, unique = true)
//     private String externalID;
// 
//     private String username;
// 
//     @OneToOne
//     private PersonType ublPerson;
// 
//     @ColumnDefault("false")
//     private Boolean showWelcomeInfo = false;
// 
//     public UaaUser() {
//     }
// 
//     public UaaUser(String username, PersonType ublPerson, String externalID) {
//         this.username = username;
//         this.ublPerson = ublPerson;
//         this.externalID = externalID;
//         this.showWelcomeInfo = true;
//     }
// 
//     public String getUsername() {
//         return username;
//     }
// 
//     public String getExternalID() {
//         return externalID;
//     }
// 
//     public PersonType getUBLPerson() {
//         return this.ublPerson;
//     }
// 
//     public Boolean getShowWelcomeInfo() {
//         return showWelcomeInfo;
//     }
// 
//     public void setShowWelcomeInfo(Boolean showWelcomeInfo) {
//         this.showWelcomeInfo = showWelcomeInfo;
//     }
// }


// Path: identity-service/src/main/java/eu/nimble/core/infrastructure/identity/utils/UblAdapter.java
import com.google.common.base.Strings;
import eu.nimble.core.infrastructure.identity.config.NimbleConfigurationProperties;
import eu.nimble.core.infrastructure.identity.entity.UaaUser;
import eu.nimble.core.infrastructure.identity.entity.dto.*;
import eu.nimble.service.model.ubl.commonaggregatecomponents.*;
import eu.nimble.service.model.ubl.commonbasiccomponents.BinaryObjectType;
import eu.nimble.service.model.ubl.commonbasiccomponents.CodeType;
import eu.nimble.service.model.ubl.commonbasiccomponents.QuantityType;
import eu.nimble.service.model.ubl.commonbasiccomponents.TextType;
import eu.nimble.service.model.ubl.extension.QualityIndicatorParameter;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;


        PaymentMeansType ublPaymentMeans = new PaymentMeansType();
        ublPaymentMeans.setInstructionNote(UblAdapter.adaptTextType(dtoPaymentMeans.getInstructionNote()));
        return ublPaymentMeans;
    }

    public static PaymentMeans adaptPaymentMeans(PaymentMeansType ublPaymentMeans) {

        if (ublPaymentMeans == null)
            return new PaymentMeans();

        PaymentMeans dtoPaymentMeans = new PaymentMeans();
        dtoPaymentMeans.setInstructionNote(UblAdapter.adaptTextType(ublPaymentMeans.getInstructionNote()));
        return dtoPaymentMeans;
    }

    public static PartyIdentificationType adaptPartyIdentifier(String identifier) {
        PartyIdentificationType partyIdentificationType = new PartyIdentificationType();
        partyIdentificationType.setID(identifier);
        return partyIdentificationType;
    }

    public static String adaptPartyIdentifier(PartyIdentificationType partyIdentification) {
        return partyIdentification.getID();
    }

    public static String adaptPartyIdentifier(PartyType partyType) {
        return adaptPartyIdentifier(Objects.requireNonNull(partyType.getPartyIdentification().stream().findFirst().orElse(null)));
    }


    public static FrontEndUser adaptUser(UaaUser uaaUser, List<PartyType> companies) {
