// Code generated by xsdgen. DO NOT EDIT.

package uniprot

import (
	"bytes"
	"encoding/xml"
	"strconv"
	"strings"
	"time"
)

type Absorption struct {
	Max  EvidencedStringType   `xml:"http://uniprot.org/uniprot max,omitempty"`
	Text []EvidencedStringType `xml:"http://uniprot.org/uniprot text,omitempty"`
}

type AlternativeName struct {
	FullName  EvidencedStringType   `xml:"http://uniprot.org/uniprot fullName,omitempty"`
	ShortName []EvidencedStringType `xml:"http://uniprot.org/uniprot shortName,omitempty"`
	EcNumber  []EvidencedStringType `xml:"http://uniprot.org/uniprot ecNumber,omitempty"`
}

type Anon6 struct {
	Type Type `xml:"type,attr"`
}

// Describes different types of citations.
// Equivalent to the flat file RX-, RG-, RA-, RT- and RL-lines.
type CitationType struct {
	Title       string            `xml:"http://uniprot.org/uniprot title,omitempty"`
	EditorList  NameListType      `xml:"http://uniprot.org/uniprot editorList,omitempty"`
	AuthorList  NameListType      `xml:"http://uniprot.org/uniprot authorList,omitempty"`
	Locator     string            `xml:"http://uniprot.org/uniprot locator,omitempty"`
	DbReference []DbReferenceType `xml:"http://uniprot.org/uniprot dbReference,omitempty"`
	Type        Type              `xml:"type,attr"`
	Date        Date              `xml:"date,attr,omitempty"`
	Name        string            `xml:"name,attr,omitempty"`
	Volume      string            `xml:"volume,attr,omitempty"`
	First       string            `xml:"first,attr,omitempty"`
	Last        string            `xml:"last,attr,omitempty"`
	Publisher   string            `xml:"publisher,attr,omitempty"`
	City        string            `xml:"city,attr,omitempty"`
	Db          string            `xml:"db,attr,omitempty"`
	Number      string            `xml:"number,attr,omitempty"`
	Institute   string            `xml:"institute,attr,omitempty"`
	Country     string            `xml:"country,attr,omitempty"`
}

// Describes a cofactor.
type CofactorType struct {
	Name        string          `xml:"http://uniprot.org/uniprot name"`
	DbReference DbReferenceType `xml:"http://uniprot.org/uniprot dbReference"`
	Evidence    IntListType     `xml:"evidence,attr,omitempty"`
}

// Describes different types of general annotations.
// Equivalent to the flat file CC-line.
type CommentType struct {
	Molecule              string                      `xml:"http://uniprot.org/uniprot molecule,omitempty"`
	Absorption            Absorption                  `xml:"http://uniprot.org/uniprot absorption,omitempty"`
	Kinetics              Kinetics                    `xml:"http://uniprot.org/uniprot kinetics,omitempty"`
	PhDependence          PhDependence                `xml:"http://uniprot.org/uniprot phDependence,omitempty"`
	RedoxPotential        RedoxPotential              `xml:"http://uniprot.org/uniprot redoxPotential,omitempty"`
	TemperatureDependence TemperatureDependence       `xml:"http://uniprot.org/uniprot temperatureDependence,omitempty"`
	Reaction              ReactionType                `xml:"http://uniprot.org/uniprot reaction,omitempty"`
	PhysiologicalReaction []PhysiologicalReactionType `xml:"http://uniprot.org/uniprot physiologicalReaction,omitempty"`
	Cofactor              []CofactorType              `xml:"http://uniprot.org/uniprot cofactor,omitempty"`
	SubcellularLocation   []SubcellularLocationType   `xml:"http://uniprot.org/uniprot subcellularLocation,omitempty"`
	Conflict              Conflict                    `xml:"http://uniprot.org/uniprot conflict,omitempty"`
	Link                  []Link                      `xml:"http://uniprot.org/uniprot link,omitempty"`
	Event                 []EventType                 `xml:"http://uniprot.org/uniprot event,omitempty"`
	Isoform               []IsoformType               `xml:"http://uniprot.org/uniprot isoform,omitempty"`
	Interactant           []InteractantType           `xml:"http://uniprot.org/uniprot interactant,omitempty"`
	OrganismsDiffer       bool                        `xml:"http://uniprot.org/uniprot organismsDiffer,omitempty"`
	Experiments           int                         `xml:"http://uniprot.org/uniprot experiments,omitempty"`
	Disease               Disease                     `xml:"http://uniprot.org/uniprot disease,omitempty"`
	Location              []LocationType              `xml:"http://uniprot.org/uniprot location,omitempty"`
	Text                  []EvidencedStringType       `xml:"http://uniprot.org/uniprot text,omitempty"`
	Type                  Type                        `xml:"type,attr"`
	LocationType          string                      `xml:"locationType,attr,omitempty"`
	Name                  string                      `xml:"name,attr,omitempty"`
	Mass                  float32                     `xml:"mass,attr,omitempty"`
	Error                 string                      `xml:"error,attr,omitempty"`
	Method                string                      `xml:"method,attr,omitempty"`
	Evidence              IntListType                 `xml:"evidence,attr,omitempty"`
}

func (t *CommentType) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
	type T CommentType
	var overlay struct {
		*T
		OrganismsDiffer *bool `xml:"http://uniprot.org/uniprot organismsDiffer,omitempty"`
	}
	overlay.T = (*T)(t)
	overlay.OrganismsDiffer = (*bool)(&overlay.T.OrganismsDiffer)
	return d.DecodeElement(&overlay, &start)
}

type Component struct {
	RecommendedName RecommendedName       `xml:"http://uniprot.org/uniprot recommendedName,omitempty"`
	AlternativeName []AlternativeName     `xml:"http://uniprot.org/uniprot alternativeName,omitempty"`
	SubmittedName   []SubmittedName       `xml:"http://uniprot.org/uniprot submittedName,omitempty"`
	AllergenName    EvidencedStringType   `xml:"http://uniprot.org/uniprot allergenName,omitempty"`
	BiotechName     EvidencedStringType   `xml:"http://uniprot.org/uniprot biotechName,omitempty"`
	CdAntigenName   []EvidencedStringType `xml:"http://uniprot.org/uniprot cdAntigenName,omitempty"`
	InnName         []EvidencedStringType `xml:"http://uniprot.org/uniprot innName,omitempty"`
}

type Conflict struct {
	Sequence Sequence `xml:"http://uniprot.org/uniprot sequence,omitempty"`
	Type     Type     `xml:"type,attr"`
}

// Describes the authors of a citation when these are represented by a consortium.
// Equivalent to the flat file RG-line.
type ConsortiumType struct {
	Name string `xml:"name,attr"`
}

// May be one of Swiss-Prot, TrEMBL
type Dataset string

type Date string

// Describes a database cross-reference.
// Equivalent to the flat file DR-line.
type DbReferenceType struct {
	Molecule string         `xml:"http://uniprot.org/uniprot molecule,omitempty"`
	Property []PropertyType `xml:"http://uniprot.org/uniprot property,omitempty"`
	Type     string         `xml:"type,attr"`
	Evidence IntListType    `xml:"evidence,attr,omitempty"`
}

// May be one of left-to-right, right-to-left
type Direction string

type Disease struct {
	Name        string          `xml:"http://uniprot.org/uniprot name"`
	Acronym     string          `xml:"http://uniprot.org/uniprot acronym"`
	Description string          `xml:"http://uniprot.org/uniprot description"`
	DbReference DbReferenceType `xml:"http://uniprot.org/uniprot dbReference"`
}

type Domain struct {
	RecommendedName RecommendedName       `xml:"http://uniprot.org/uniprot recommendedName,omitempty"`
	AlternativeName []AlternativeName     `xml:"http://uniprot.org/uniprot alternativeName,omitempty"`
	SubmittedName   []SubmittedName       `xml:"http://uniprot.org/uniprot submittedName,omitempty"`
	AllergenName    EvidencedStringType   `xml:"http://uniprot.org/uniprot allergenName,omitempty"`
	BiotechName     EvidencedStringType   `xml:"http://uniprot.org/uniprot biotechName,omitempty"`
	CdAntigenName   []EvidencedStringType `xml:"http://uniprot.org/uniprot cdAntigenName,omitempty"`
	InnName         []EvidencedStringType `xml:"http://uniprot.org/uniprot innName,omitempty"`
}

type Entry struct {
	Accession        []string             `xml:"http://uniprot.org/uniprot accession"`
	Name             []string             `xml:"http://uniprot.org/uniprot name"`
	Protein          ProteinType          `xml:"http://uniprot.org/uniprot protein"`
	Gene             []GeneType           `xml:"http://uniprot.org/uniprot gene,omitempty"`
	Organism         OrganismType         `xml:"http://uniprot.org/uniprot organism"`
	OrganismHost     []OrganismType       `xml:"http://uniprot.org/uniprot organismHost,omitempty"`
	GeneLocation     []GeneLocationType   `xml:"http://uniprot.org/uniprot geneLocation,omitempty"`
	Reference        []ReferenceType      `xml:"http://uniprot.org/uniprot reference"`
	Comment          []CommentType        `xml:"http://uniprot.org/uniprot comment,omitempty"`
	DbReference      []DbReferenceType    `xml:"http://uniprot.org/uniprot dbReference,omitempty"`
	ProteinExistence ProteinExistenceType `xml:"http://uniprot.org/uniprot proteinExistence"`
	Keyword          []KeywordType        `xml:"http://uniprot.org/uniprot keyword,omitempty"`
	Feature          []FeatureType        `xml:"http://uniprot.org/uniprot feature,omitempty"`
	Evidence         []EvidenceType       `xml:"http://uniprot.org/uniprot evidence,omitempty"`
	Sequence         SequenceType         `xml:"http://uniprot.org/uniprot sequence"`
	Dataset          Dataset              `xml:"dataset,attr"`
	Created          time.Time            `xml:"created,attr"`
	Modified         time.Time            `xml:"modified,attr"`
	Version          int                  `xml:"version,attr"`
}

func (t *Entry) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
	type T Entry
	var overlay struct {
		*T
		Created  *xsdDate `xml:"created,attr"`
		Modified *xsdDate `xml:"modified,attr"`
	}
	overlay.T = (*T)(t)
	overlay.Created = (*xsdDate)(&overlay.T.Created)
	overlay.Modified = (*xsdDate)(&overlay.T.Modified)
	return d.DecodeElement(&overlay, &start)
}

// Describes the type of events that cause alternative products.
type EventType struct {
	Type Type `xml:"type,attr"`
}

// Describes the evidence for an annotation.
// No flat file equivalent.
type EvidenceType struct {
	Source       SourceType       `xml:"http://uniprot.org/uniprot source,omitempty"`
	ImportedFrom ImportedFromType `xml:"http://uniprot.org/uniprot importedFrom,omitempty"`
	Type         string           `xml:"type,attr"`
	Key          int              `xml:"key,attr"`
}

type EvidencedStringType struct {
	Value    string      `xml:",chardata"`
	Evidence IntListType `xml:"evidence,attr,omitempty"`
}

// Describes different types of sequence annotations.
// Equivalent to the flat file FT-line.
type FeatureType struct {
	Original    string       `xml:"http://uniprot.org/uniprot original,omitempty"`
	Variation   []string     `xml:"http://uniprot.org/uniprot variation,omitempty"`
	Location    LocationType `xml:"http://uniprot.org/uniprot location"`
	Type        Type         `xml:"type,attr"`
	Description string       `xml:"description,attr,omitempty"`
	Evidence    IntListType  `xml:"evidence,attr,omitempty"`
}

// May be one of single, multiple
type Fragment string

// Describes non-nuclear gene locations (organelles and plasmids).
// Equivalent to the flat file OG-line.
type GeneLocationType struct {
	Name     []StatusType `xml:"http://uniprot.org/uniprot name,omitempty"`
	Type     Type         `xml:"type,attr"`
	Evidence IntListType  `xml:"evidence,attr,omitempty"`
}

// Describes different types of gene designations.
// Equivalent to the flat file GN-line.
type GeneNameType struct {
	Value    string      `xml:",chardata"`
	Evidence IntListType `xml:"evidence,attr,omitempty"`
	Type     Type        `xml:"type,attr"`
}

// Describes a gene.
// Equivalent to the flat file GN-line.
type GeneType struct {
	Name []GeneNameType `xml:"http://uniprot.org/uniprot name"`
}

// Describes the source of the evidence, when it is not assigned by UniProt, but imported from an external database.
type ImportedFromType struct {
	DbReference DbReferenceType `xml:"http://uniprot.org/uniprot dbReference"`
}

type IntListType []int

func (x *IntListType) UnmarshalText(text []byte) error {
	for _, v := range strings.Fields(string(text)) {
		if i, err := strconv.Atoi(v); err != nil {
			return err
		} else {
			*x = append(*x, i)
		}
	}
	return nil
}

type InteractantType struct {
	Id          string          `xml:"http://uniprot.org/uniprot id"`
	Label       string          `xml:"http://uniprot.org/uniprot label,omitempty"`
	DbReference DbReferenceType `xml:"http://uniprot.org/uniprot dbReference,omitempty"`
	IntactId    string          `xml:"intactId,attr"`
}

// Describes isoforms in 'alternative products' annotations.
type IsoformType struct {
	Id       []string              `xml:"http://uniprot.org/uniprot id"`
	Name     []Name                `xml:"http://uniprot.org/uniprot name"`
	Sequence Anon6                 `xml:"http://uniprot.org/uniprot sequence"`
	Text     []EvidencedStringType `xml:"http://uniprot.org/uniprot text,omitempty"`
}

type KeywordType struct {
	Value    string      `xml:",chardata"`
	Evidence IntListType `xml:"evidence,attr,omitempty"`
}

type Kinetics struct {
	KM   []EvidencedStringType `xml:"http://uniprot.org/uniprot KM,omitempty"`
	Vmax []EvidencedStringType `xml:"http://uniprot.org/uniprot Vmax,omitempty"`
	Text []EvidencedStringType `xml:"http://uniprot.org/uniprot text,omitempty"`
}

type Lineage struct {
	Taxon []string `xml:"http://uniprot.org/uniprot taxon"`
}

type Link struct {
	Uri string `xml:"uri,attr"`
}

// Describes a sequence location as either a range with a begin and end or as a position. The 'sequence' attribute is only used when the location is not on the canonical sequence displayed in the current entry.
type LocationType struct {
	Begin    PositionType `xml:"http://uniprot.org/uniprot begin,omitempty"`
	End      PositionType `xml:"http://uniprot.org/uniprot end,omitempty"`
	Position PositionType `xml:"http://uniprot.org/uniprot position,omitempty"`
	Sequence string       `xml:"sequence,attr,omitempty"`
}

type Name struct {
	Value    string      `xml:",chardata"`
	Evidence IntListType `xml:"evidence,attr,omitempty"`
}

type NameListType struct {
	Consortium ConsortiumType `xml:"http://uniprot.org/uniprot consortium,omitempty"`
	Person     PersonType     `xml:"http://uniprot.org/uniprot person,omitempty"`
}

// Describes different types of source organism names.
type OrganismNameType struct {
	Value string `xml:",chardata"`
	Type  Type   `xml:"type,attr"`
}

// Describes the source organism.
type OrganismType struct {
	Name        []OrganismNameType `xml:"http://uniprot.org/uniprot name"`
	DbReference []DbReferenceType  `xml:"http://uniprot.org/uniprot dbReference"`
	Lineage     Lineage            `xml:"http://uniprot.org/uniprot lineage,omitempty"`
	Evidence    IntListType        `xml:"evidence,attr,omitempty"`
}

type PersonType struct {
	Name string `xml:"name,attr"`
}

type PhDependence struct {
	Text []EvidencedStringType `xml:"http://uniprot.org/uniprot text"`
}

// Describes a physiological reaction.
type PhysiologicalReactionType struct {
	DbReference DbReferenceType `xml:"http://uniprot.org/uniprot dbReference"`
	Direction   Direction       `xml:"direction,attr"`
	Evidence    IntListType     `xml:"evidence,attr,omitempty"`
}

type Plasmid struct {
	Value    string      `xml:",chardata"`
	Evidence IntListType `xml:"evidence,attr,omitempty"`
}

type PositionType struct {
	Position uint64      `xml:"position,attr,omitempty"`
	Status   Status      `xml:"status,attr,omitempty"`
	Evidence IntListType `xml:"evidence,attr,omitempty"`
}

func (t *PositionType) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
	type T PositionType
	var overlay struct {
		*T
		Status *Status `xml:"status,attr,omitempty"`
	}
	overlay.T = (*T)(t)
	overlay.Status = (*Status)(&overlay.T.Status)
	return d.DecodeElement(&overlay, &start)
}

type PropertyType struct {
	Type  string `xml:"type,attr"`
	Value string `xml:"value,attr"`
}

// Describes the evidence for the protein's existence.
// Equivalent to the flat file PE-line.
type ProteinExistenceType struct {
	Type Type `xml:"type,attr"`
}

// Describes the names for the protein and parts thereof.
// Equivalent to the flat file DE-line.
type ProteinType struct {
	RecommendedName RecommendedName       `xml:"http://uniprot.org/uniprot recommendedName,omitempty"`
	AlternativeName []AlternativeName     `xml:"http://uniprot.org/uniprot alternativeName,omitempty"`
	SubmittedName   []SubmittedName       `xml:"http://uniprot.org/uniprot submittedName,omitempty"`
	AllergenName    EvidencedStringType   `xml:"http://uniprot.org/uniprot allergenName,omitempty"`
	BiotechName     EvidencedStringType   `xml:"http://uniprot.org/uniprot biotechName,omitempty"`
	CdAntigenName   []EvidencedStringType `xml:"http://uniprot.org/uniprot cdAntigenName,omitempty"`
	InnName         []EvidencedStringType `xml:"http://uniprot.org/uniprot innName,omitempty"`
	Domain          []Domain              `xml:"http://uniprot.org/uniprot domain,omitempty"`
	Component       []Component           `xml:"http://uniprot.org/uniprot component,omitempty"`
}

// Describes a chemical reaction.
type ReactionType struct {
	Text        string            `xml:"http://uniprot.org/uniprot text"`
	DbReference []DbReferenceType `xml:"http://uniprot.org/uniprot dbReference"`
	Evidence    IntListType       `xml:"evidence,attr,omitempty"`
}

type RecommendedName struct {
	FullName  EvidencedStringType   `xml:"http://uniprot.org/uniprot fullName"`
	ShortName []EvidencedStringType `xml:"http://uniprot.org/uniprot shortName,omitempty"`
	EcNumber  []EvidencedStringType `xml:"http://uniprot.org/uniprot ecNumber,omitempty"`
}

type RedoxPotential struct {
	Text []EvidencedStringType `xml:"http://uniprot.org/uniprot text"`
}

// Describes a citation and a summary of its content.
// Equivalent to the flat file RN-, RP-, RC-, RX-, RG-, RA-, RT- and RL-lines.
type ReferenceType struct {
	Citation CitationType   `xml:"http://uniprot.org/uniprot citation"`
	Scope    []string       `xml:"http://uniprot.org/uniprot scope"`
	Source   SourceDataType `xml:"http://uniprot.org/uniprot source,omitempty"`
	Evidence IntListType    `xml:"evidence,attr,omitempty"`
	Key      string         `xml:"key,attr"`
}

// May be one of EMBL-CDS, EMBL
type Resource string

type Sequence struct {
	Resource Resource `xml:"resource,attr"`
	Version  int      `xml:"version,attr,omitempty"`
}

type SequenceType struct {
	Value     string    `xml:",chardata"`
	Length    int       `xml:"length,attr"`
	Mass      int       `xml:"mass,attr"`
	Checksum  string    `xml:"checksum,attr"`
	Modified  time.Time `xml:"modified,attr"`
	Version   int       `xml:"version,attr"`
	Precursor bool      `xml:"precursor,attr,omitempty"`
	Fragment  Fragment  `xml:"fragment,attr,omitempty"`
}

func (t *SequenceType) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
	type T SequenceType
	var overlay struct {
		*T
		Modified *xsdDate `xml:"modified,attr"`
	}
	overlay.T = (*T)(t)
	overlay.Modified = (*xsdDate)(&overlay.T.Modified)
	return d.DecodeElement(&overlay, &start)
}

// Describes the source of the sequence according to the citation.
// Equivalent to the flat file RC-line.
type SourceDataType struct {
	Strain     Strain     `xml:"http://uniprot.org/uniprot strain,omitempty"`
	Plasmid    Plasmid    `xml:"http://uniprot.org/uniprot plasmid,omitempty"`
	Transposon Transposon `xml:"http://uniprot.org/uniprot transposon,omitempty"`
	Tissue     Tissue     `xml:"http://uniprot.org/uniprot tissue,omitempty"`
}

// Describes the source of the data using a database cross-reference (or a 'ref' attribute when the source cannot be found in a public data source, such as PubMed, and is cited only within the UniProtKB entry).
type SourceType struct {
	DbReference DbReferenceType `xml:"http://uniprot.org/uniprot dbReference,omitempty"`
}

// May be one of certain, uncertain, less than, greater than, unknown
type Status string

// Indicates whether the name of a plasmid is known or unknown.
type StatusType struct {
	Value  string `xml:",chardata"`
	Status Status `xml:"status,attr,omitempty"`
}

type Strain struct {
	Value    string      `xml:",chardata"`
	Evidence IntListType `xml:"evidence,attr,omitempty"`
}

// Describes the subcellular location and optionally the topology and orientation of a molecule.
type SubcellularLocationType struct {
	Location    []EvidencedStringType `xml:"http://uniprot.org/uniprot location"`
	Topology    []EvidencedStringType `xml:"http://uniprot.org/uniprot topology,omitempty"`
	Orientation []EvidencedStringType `xml:"http://uniprot.org/uniprot orientation,omitempty"`
}

type SubmittedName struct {
	FullName EvidencedStringType   `xml:"http://uniprot.org/uniprot fullName"`
	EcNumber []EvidencedStringType `xml:"http://uniprot.org/uniprot ecNumber,omitempty"`
}

type TemperatureDependence struct {
	Text []EvidencedStringType `xml:"http://uniprot.org/uniprot text"`
}

type Tissue struct {
	Value    string      `xml:",chardata"`
	Evidence IntListType `xml:"evidence,attr,omitempty"`
}

type Transposon struct {
	Value    string      `xml:",chardata"`
	Evidence IntListType `xml:"evidence,attr,omitempty"`
}

// May be one of apicoplast, chloroplast, organellar chromatophore, cyanelle, hydrogenosome, mitochondrion, non-photosynthetic plastid, nucleomorph, plasmid, plastid
type Type string

type Uniprot struct {
	Entry     []string `xml:"http://uniprot.org/uniprot entry"`
	Copyright string   `xml:"http://uniprot.org/uniprot copyright,omitempty"`
}

type xsdDate time.Time

func (t *xsdDate) UnmarshalText(text []byte) error {
	return _unmarshalTime(text, (*time.Time)(t), "2006-01-02")
}
func _unmarshalTime(text []byte, t *time.Time, format string) (err error) {
	s := string(bytes.TrimSpace(text))
	*t, err = time.Parse(format, s)
	return err
}
