TaxonomySpeciesDTO.java

/*
 * Copyright 2026 Global Crop Diversity Trust
 * Licensed under the Apache License, Version 2.0
 * See LICENSE file in project root folder or http://www.apache.org/licenses/LICENSE-2.0
 */

package org.gringlobal.api.model;

import static org.gringlobal.model.community.CommunityCodeValues.CODE_VALUE_LENGTH;

import java.time.Instant;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import org.gringlobal.custom.validation.javax.CodeValueField;
import org.gringlobal.custom.validation.javax.OneLine;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
public class TaxonomySpeciesDTO extends CooperatorOwnedDTO {

	/** GRIN Taxonomy Species ID: The id of this name in USDA GRIN Taxonomy. */
	private Long grinId;

	/** Taxon: The binomial or trinomial representation of the taxon name. Not required: calculated automatically when null. */
	@Size(max = 100) @OneLine
	private String name;

	/** Taxon Authority: The author for the lowest ranking part of the taxon name. */
	@Size(max = 100) @OneLine
	private String nameAuthority;

	/** Alternate Name: An alternative group name for this taxon under the International Code of Nomenclature for Cultivated Plants. */
	@Size(max = 2000) @OneLine
	private String alternateName;

	/** Hybrid Parentage: The hybrid parentage of the taxon. */
	@Size(max = 500) @OneLine
	private String hybridParentage;

	/** TaxonomyGenus: Reference to the extended genus described by this taxonomy species. */
	@NotNull private TaxonomyGenusInfo taxonomyGenus;

	/** Species: The specific epithet of the taxonomic species name. */
	@NotNull @Size(min = 1, max = 30) @OneLine
	private String speciesName;

	/** Species Authority: The author of the species name. */
	@Size(max = 100) @OneLine
	private String speciesAuthority;

	/** Is Interspecific Hybrid?: A code to indicate an interspecific hybrid within the genus. */
	@NotNull private Boolean isSpecificHybrid = false;

	/** Subspecies: The subspecific epithet for the taxon. */
	@Size(max = 30) @OneLine
	private String subspeciesName;

	/** Subspecies Authority: The author of the subspecies name. */
	@Size(max = 100) @OneLine
	private String subspeciesAuthority;

	/** Is Subspecific Hybrid?: Y/N code indicates an intersubspecific hybrid within the species. */
	@NotNull private Boolean isSubspecificHybrid = false;

	/** Variety: The varietal epithet for the taxon. */
	@Size(max = 30) @OneLine
	private String varietyName;

	/** Variety Authority: The author of the varietal name. */
	@Size(max = 100) @OneLine
	private String varietyAuthority;

	/** Is Intervarietal Hybrid?: Y/N code indicates an intervarietal hybrid within the species. */
	@NotNull private Boolean isVarietalHybrid = false;

	/** Subvariety: The subvarietal epithet for the taxon. */
	@Size(max = 30) @OneLine
	private String subvarietyName;

	/** Subvarietal Authority: The author of the subvarietal epithet. */
	@Size(max = 100) @OneLine
	private String subvarietyAuthority;

	/** Is Subvarietal Hybrid?: Y/N code indicates an intersubvarietal hybrid within the species. */
	@NotNull private Boolean isSubvarietalHybrid = false;

	/** Forma Rank: The rank indicator for the forma epithet. */
	@Size(max = 30) @OneLine
	private String formaRankType;

	/** Forma: The forma or other unranked epithet for the taxon. */
	@Size(max = 30) @OneLine
	private String formaName;

	/** Forma Authority: The author string for the forma or other epithet. */
	@Size(max = 100) @OneLine
	private String formaAuthority;

	/** Is Forma Hybrid?: Y/N code indicates an interforma hybrid within the species. */
	@NotNull private Boolean isFormaHybrid = false;

	/** Life Form: The normal life form of the species. Uses ACCESSION_LIFE_FORM vocabulary. */
	@Size(max = CODE_VALUE_LENGTH) @CodeValueField(value = "ACCESSION_LIFE_FORM", strict = false)
	private String lifeFormCode;

	/** Nomen Number: The taxonomic species number. No decimals; whole numbers only. */
	private Integer nomenNumber;

	/** Is Name Pending?: Y/N flag indicating the status of the name is in question. */
	@NotNull private Boolean isNamePending = false;

	/** Cooperator: Reference to the name-verifying cooperator described by this taxonomy species. */
	private CooperatorInfo verifierCooperator;

	/** Name Verification Date: Date when the name was verified. */
	private Instant nameVerifiedDate;

	/** Common Fertilization: The type of fertilization that is common in this species. Uses TAXONOMY_FERTILIZATION_METHOD vocabulary. */
	@Size(max = CODE_VALUE_LENGTH) @CodeValueField(value = "TAXONOMY_FERTILIZATION_METHOD", strict = false)
	private String commonFertilizationCode;

	/** Restriction: Restrictions on the taxon that may affect distributions of accessions. Uses TAXONOMY_RESTRICTION vocabulary. */
	@Size(max = CODE_VALUE_LENGTH) @CodeValueField(value = "TAXONOMY_RESTRICTION", strict = false)
	private String restrictionCode;

	/** Synonym Code: A code to indicate the type of synonym. Uses TAXONOMY_SPECIES_QUALIFIER vocabulary. */
	@Size(max = CODE_VALUE_LENGTH) @CodeValueField(value = "TAXONOMY_SPECIES_QUALIFIER", strict = false)
	private String synonymCode;

	/** TaxonomySpecies: Reference to the current taxon described by this taxonomy species. */
	private TaxonomySpeciesInfo currentTaxonomySpecies;

	/** Cooperator: Reference to the first curator described by this taxonomy species. */
	private CooperatorInfo curator1Cooperator;

	/** Cooperator: Reference to the second curator described by this taxonomy species. */
	private CooperatorInfo curator2Cooperator;

	/** Site: Reference to the first priority maintenance site described by this taxonomy species. */
	private SiteInfo priority1Site;

	/** Site: Reference to the second priority maintenance site described by this taxonomy species. */
	private SiteInfo priority2Site;

	/** Site Note: General remarks about the taxonomic species or infraspecies provided by the maintenance institute. */
	private String siteNote;

	/** Protologue: The original literature reference for the species. */
	@Size(max = 500) @OneLine
	private String protologue;

	/** Protologue Link: Link to protologue description on the web. */
	private String protologueVirtualPath;

	/** Is Web Visible?: Whether this taxonomy species is visible on the web. */
	@NotNull private Boolean isWebVisible = false;

	/** Note: Generic comments about the taxonomic species. */
	private String note;

	public TaxonomySpeciesDTO(Long id) {
		this.id = id;
	}
}