package uk.ac.ebi.quickgo.ontology.model;

import uk.ac.ebi.quickgo.common.FieldType;
import uk.ac.ebi.quickgo.ontology.common.document.Aspect;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.List;

/**
 * GO term DTO used by the service layer.
 *
 * Created 13/11/15
 * @author Edd
 */
public class GOTerm extends OBOTerm {
    // refers to the namespace/ontology to which the GO ID belongs
    public Aspect aspect;

    // describes where this term can be used
    public Usage usage;

    public List<BlacklistItem> blacklist;
    public List<GODiscussion> goDiscussions;

    public enum Usage {
        UNRESTRICTED("Unrestricted", "U"),
        ELECTRONIC("Electronic", "E"),
        NONE("None", "N");

        private final String fullName;
        private final String abbreviation;

        Usage(String fullName, String abbreviation) {
            this.fullName = fullName;
            this.abbreviation = abbreviation;
        }

        public static Usage fromFullName(String fullName) {
            for (Usage usage : Usage.values()) {
                if (usage.fullName.equals(fullName)) {
                    return usage;
                }
            }
            throw new IllegalArgumentException("Unrecognized Usage fullName: " + fullName);
        }

        public String getFullName() {
            return fullName;
        }

        public String getAbbreviation() {
            return abbreviation;
        }

        @JsonValue
        public String getName() {
            return getFullName();
        }
    }

    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    public static class BlacklistItem implements FieldType {
        public String goId;
        public String reason;
        public String category;
        public String methodId;
        public String entityType;
        public String entityId;
        public String taxonId;
        public String entityName;
        public String ancestorGoId;
    }

    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    public static class GODiscussion implements FieldType {
        public String title;
        public String url;
    }
}
@@ -642,16 +642,64 @@
 ussions;
+%0A    public List%3CExtendedXRef%3E proteinComplexes;
 %0A%0A    pu
@@ -2233,10 +2233,168 @@
 l;%0A    %7D
+%0A%0A    @JsonInclude(JsonInclude.Include.NON_EMPTY)%0A    public static class ExtendedXRef extends XRef implements FieldType %7B%0A        public String symbol;%0A    %7D
 %0A%7D

Add ExtendedXref class in GOTerm class to represent xrefs with an extra field (name).