package org.kar.karideo.model;

import org.kar.archidata.annotation.DataIfNotExists;
import org.kar.archidata.annotation.DataNotRead;
import org.kar.archidata.model.GenericDataSoftDelete;

import com.fasterxml.jackson.annotation.JsonInclude;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.annotation.Nullable;
import jakarta.persistence.Column;
import jakarta.persistence.FetchType;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;

@Table(name = "userMediaAdvancement")
@DataIfNotExists
@JsonInclude(JsonInclude.Include.NON_NULL)
public class UserMediaAdvancement extends GenericDataSoftDelete {
	@DataNotRead
	@Column(nullable = false)
	@Schema(description = "Foreign Key Id of the user")
	@ManyToOne(fetch = FetchType.LAZY, targetEntity = UserKarideo.class)
	@Nullable
	public Long userId;
	@Column(nullable = false)
	@Schema(description = "Id of the media")
	@ManyToOne(fetch = FetchType.LAZY, targetEntity = Media.class)
	public Long mediaId;
	@Column(nullable = false)
	@Schema(description = "Percent of advancement in the media")
	public Float percent;
	@Column(nullable = false)
	@Schema(description = "Number of second of advancement in the media")
	public Integer time;
	@Column(nullable = false)
	@Schema(description = "Number of time this media has been read")
	public Integer count;
}
