package com.vibevault.model;

import jakarta.persistence.*;

/**
 * 姝屾洸瀹炰綋绫?
 *
 * 闇€瑕佸疄鐜帮細
 * - 灏嗘绫绘槧灏勪负鏁版嵁搴撹〃 "songs"
 * - id 浣滀负鑷涓婚敭
 * - 姣忛姝屾洸灞炰簬涓€涓瓕鍗曪紙澶氬涓€鍏崇郴锛?
 */
@Entity
@Table(name = "songs")
public class Song {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(nullable = false)
    private String title;

    @Column(nullable = false)
    private String artist;

    @Column(nullable = false)
    private int durationInSeconds;

    @ManyToOne
    @JoinColumn(name = "playlist_id")
    private Playlist playlist;

    public Song() {
    }

    public Song(String title, String artist, int durationInSeconds) {
        this.title = title;
        this.artist = artist;
        this.durationInSeconds = durationInSeconds;
    }

    public Long getId() {
        return id;
    }

    public String getTitle() {
        return title;
    }

    public String getArtist() {
        return artist;
    }

    public int getDurationInSeconds() {
        return durationInSeconds;
    }

    public Playlist getPlaylist() {
        return playlist;
    }

    public void setPlaylist(Playlist playlist) {
        this.playlist = playlist;
    }
}