InventoryDTO.java

/*
 * Copyright 2026 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.gringlobal.model.elastic;

import lombok.Getter;
import lombok.Setter;
import org.gringlobal.custom.elasticsearch.SearchField;
import org.gringlobal.custom.validation.javax.CodeValueField;
import org.gringlobal.model.community.CommunityCodeValues;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.util.Date;
import java.util.List;

@Getter
@Setter
@Document(indexName = "inventory")
public class InventoryDTO {

	private Long id;

	@Field(type = FieldType.Object)
	private AccessionInfo accession;

	@Field(type = FieldType.Object)
	private SiteInfo site;

	private Date availabilityEndDate;

	private Date availabilityStartDate;

	@CodeValueField(CommunityCodeValues.INVENTORY_AVAILABILITY_STATUS)
	private String availabilityStatusCode;

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

	@CodeValueField("INVENTORY_AVAILABILITY_REASON")
	private String availabilityReasonCode;

	private Double distributionCriticalQuantity;

	@CodeValueField(CommunityCodeValues.GERMPLASM_FORM)
	private String distributionDefaultFormCode;

	private Double distributionDefaultQuantity;

	@CodeValueField(CommunityCodeValues.UNIT_OF_QUANTITY)
	private String distributionUnitCode;

	@CodeValueField(CommunityCodeValues.GERMPLASM_FORM)
	private String formTypeCode;

	private Double hundredSeedWeight;

	@Field(type = FieldType.Object)
	private InventoryMaintenancePolicyInfo inventoryMaintenancePolicy;

	@SearchField
	@Field(type = FieldType.Keyword)
	private String inventoryNumber;

	@Field(type = FieldType.Keyword)
	private String inventoryNumberPart1;

	private Long inventoryNumberPart2;

	@Field(type = FieldType.Keyword)
	private String inventoryNumberPart3;

	@Field(type = FieldType.Keyword)
	private String isAutoDeducted;

	@Field(type = FieldType.Keyword)
	private String isAvailable;

	@Field(type = FieldType.Keyword)
	private String isDistributable;

	private Double latitude;

	private Double longitude;

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

	@CodeValueField(value = CommunityCodeValues.PATHOGEN_STATUS, indexed = true)
	private String pathogenStatusCode;

	@CodeValueField("INVENTORY_PLANT_SEX")
	private String plantSexCode;

	@CodeValueField("INVENTORY_POLLINATION_METHOD")
	private String pollinationMethodCode;

	@CodeValueField("INVENTORY_POLLINATION_VECTOR")
	private String pollinationVectorCode;

	@Field(type = FieldType.Object)
	private MethodInfo preservationMethod;

	private Date propagationDate;

	@CodeValueField(CommunityCodeValues.DATE_FORMAT)
	private String propagationDateCode;

	private Double quantityOnHand;

	@CodeValueField(CommunityCodeValues.UNIT_OF_QUANTITY)
	private String quantityOnHandUnitCode;

	private Double regenerationCriticalQuantity;

	@Field(type = FieldType.Object)
	private MethodInfo regenerationMethod;

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

	@Field(type = FieldType.Keyword)
	private String barcode;

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

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

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

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

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

	@CodeValueField(CommunityCodeValues.CONTAINER_TYPE)
	private String containerTypeCode;

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

	@Field(type = FieldType.Nested)
	private List<AccessionInvNameInfo> names;

	@Field(type = FieldType.Object)
	private InventoryExtraDTO extra;

	@Field(type = FieldType.Keyword)
	private String doi;

	private Long generation;

	private Integer distributionRank;

	@Field(type = FieldType.Object)
	private GeographyInfo productionLocationGeography;
}