package org.kar.karusic.model;

import java.time.LocalDate;
import java.util.List;

import org.bson.types.ObjectId;
import org.kar.archidata.annotation.DataIfNotExists;
import org.kar.archidata.annotation.DataJson;
import org.kar.archidata.dataAccess.options.CheckJPA;
import org.kar.archidata.model.Data;
import org.kar.archidata.model.GenericDataSoftDelete;

import com.fasterxml.jackson.annotation.JsonInclude;

import dev.morphia.annotations.Entity;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.annotation.Nullable;
import jakarta.persistence.Column;
import jakarta.persistence.Table;

@Entity("Artist")
@Table(name = "artist")
@DataIfNotExists
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Artist extends GenericDataSoftDelete {
	public static class ArtistChecker extends CheckJPA<Artist> {
		public ArtistChecker() {
			super(Artist.class);
		}
	}

	@Column(length = 256)
	public String name = null;
	@Column(length = 0)
	public String description = null;
	@Schema(description = "List of Id of the specific covers")
	@DataJson(targetEntity = Data.class)
	@Nullable
	public List<ObjectId> covers = null;
	@Column(length = 256)
	public String firstName = null;
	@Column(length = 256)
	public String surname = null;
	public LocalDate birth = null;
	public LocalDate death = null;

	@Override
	public String toString() {
		return "Artist [id=" + this.id + ", name=" + this.name + ", description=" + this.description + ", covers=" + this.covers + ", firstName=" + this.firstName + ", surname=" + this.surname
				+ ", birth=" + this.birth + ", death=" + this.death + "]";
	}
}
