RetractedDOI.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.genesys.server.model.impl;

import java.time.Instant;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

import org.genesys.blocks.model.BasicModel;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.data.annotation.CreatedDate;

@Entity
@Table(name = "retracted_doi")
@Getter
@Setter
@NoArgsConstructor
public class RetractedDOI extends BasicModel {

	@NotNull
	@Pattern.List({
		@Pattern(regexp = "^10\\.[0-9]+(\\.[0-9]+)*/.+"),
	})
	@Column(name = "doi", length = 100)
	private String doi;

	@Column(name = "retractedDate", updatable = false)
	private Instant retractedDate;

	@CreatedDate
	@Column(name = "createdDate", updatable = false)
	private Instant createdDate;

	public RetractedDOI(String doi) {
		this.doi = doi;
	}

	@Override
	public boolean canEqual(Object other) {
		return other instanceof RetractedDOI;
	}
}