package org.kar.karusic.model;
/*
CREATE TABLE `node` (
  `id` bigint NOT NULL COMMENT 'table ID' AUTO_INCREMENT PRIMARY KEY,
  `deleted` BOOLEAN NOT NULL DEFAULT false,
  `create_date` datetime NOT NULL DEFAULT now() COMMENT 'Time the element has been created',
  `modify_date` datetime NOT NULL DEFAULT now() COMMENT 'Time the element has been update',
  `type` enum("TYPE", "UNIVERS", "SERIE", "SAISON", "MEDIA") NOT NULL DEFAULT 'TYPE',
  `name` TEXT COLLATE 'utf8_general_ci' NOT NULL,
  `description` TEXT COLLATE 'utf8_general_ci',
  `parent_id` bigint
) AUTO_INCREMENT=10;
*/

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.FetchType;
import jakarta.persistence.ManyToMany;
import jakarta.persistence.Table;

@Entity("Playlist")
@Table(name = "playlist")
@DataIfNotExists
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Playlist extends GenericDataSoftDelete {
	public static class PlaylistChecker extends CheckJPA<Playlist> {
		public PlaylistChecker() {
			super(Playlist.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;
	@ManyToMany(fetch = FetchType.LAZY, targetEntity = Track.class)
	public List<ObjectId> tracks = null;
}
