package com.example.demo.entity;

import jakarta.persistence.*;
import java.time.LocalDateTime;

@Entity
@Table(name = "favorites")
public class Favorite {

    @EmbeddedId
    private FavoriteId id;

    @Column(name = "created_at")
    private LocalDateTime createdAt;

    public Favorite() {}

    public Favorite(Integer userId, Integer recipeId) {
        this.id = new FavoriteId(userId, recipeId);
        this.createdAt = LocalDateTime.now();
    }

    // Getters and setters
    public FavoriteId getId() { return id; }
    public void setId(FavoriteId id) { this.id = id; }

    public LocalDateTime getCreatedAt() { return createdAt; }
    public void setCreatedAt(LocalDateTime createdAt) { this.createdAt = createdAt; }
}