package com.example.video_downloader.entity;

import jakarta.persistence.*;
import lombok.Data;
import lombok.ToString;

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

@Data
@ToString
@Entity
@Table(name = "videos")
public class Video {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    private String url;
    private String name;

    @Column(name = "upload_date")
    private String uploadDate;

    private String duration;

    @Enumerated(EnumType.STRING)
    private StatusEnum status;

    @Column(name="full_path")
    private String fullPath;

    @ManyToMany
    @JoinTable(
            name = "video_playlist",
            joinColumns = @JoinColumn(name = "video_id"),
            inverseJoinColumns = @JoinColumn(name = "playlist_id")
    )
    private List<Playlist> playlist = new ArrayList<>();

    @OneToOne
    @JoinColumn(name = "creator_id")
    private Creator creator;

}
