AccessionDTO.java

/*
 * Copyright 2025 Global Crop Diversity Trust
 *
 * 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.genesys.server.model.elastic;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import lombok.Getter;
import lombok.Setter;
import org.genesys.server.model.genesys.AccessionData;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.time.Instant;
import java.util.List;
import java.util.UUID;

@Getter
@Setter
@Document(indexName = "accession")
public class AccessionDTO {

	private Long id;
	private boolean active;
	private Integer version;
	private Instant createdDate;
	private Instant lastModifiedDate;

	// Accession fields
	@Field(type = FieldType.Keyword)
	private List<UUID> datasets;
	@Field(type = FieldType.Keyword)
	private List<UUID> subsets;
	@Field(type = FieldType.Keyword)
	private List<UUID> diversityTrees;

	// AccessionData fields
	@JsonUnwrapped
	@Field(type = FieldType.Auto)
	private AccessionIdDTO accessionId;

	private String doi;

	private String dataProviderId;

	private String instituteCode;

	@Field(type = FieldType.Text)
	private String genus;

	@Field(type = FieldType.Object)
	private FaoInstituteDTO institute;

	@Field(type = FieldType.Text)
	private String accessionNumber;

	private double seqNo;

	private String cropName;

	@Field(type = FieldType.Object)
	private CropInfo crop;

	@Field(type = FieldType.Object)
	private Taxonomy2DTO taxonomy;

	private String acquisitionSource;

	private String acquisitionDate;

	private String origCty;

	@Field(type = FieldType.Object)
	private CountryDTO countryOfOrigin;

	private Integer sampStat;

	private boolean inSvalbard;

	private Boolean inTrust;

	private Boolean available;

	private boolean historic;

	private Boolean aegis;

	private Boolean mlsStatus;

	private String acceUrl;

	private String accNames;

	private String otherIds;

	private String donorCode;

	private String donorName;

	private String donorNumb;

	private String ancest;

	@Field(type = FieldType.Keyword)
	private AccessionData.CurationType curationType;

	@JsonInclude
	private boolean sgsv;

	private String accessionName;
}