using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace MealPlan.Api.Models;

[Table("RecipeGeneratorSessions")]
public class RecipeGeneratorSession
{
    [Column("Id")]
    public int Id { get; set; }

    [Column("UserId")]
    public Guid UserId { get; set; }

    [Column("Status")]
    [MaxLength(32)]
    public string Status { get; set; } = RecipeGeneratorStatuses.Draft;

    [Column("ConstraintsJson")]
    public string ConstraintsJson { get; set; } = "{}";

    [Column("DraftJson")]
    public string? DraftJson { get; set; }

    [Column("SavedRecipeId")]
    public int? SavedRecipeId { get; set; }

    [Column("GenerationVersion")]
    public int GenerationVersion { get; set; } = 1;

    [Column("CreatedAt")]
    public DateTime CreatedAt { get; set; }

    [Column("UpdatedAt")]
    public DateTime? UpdatedAt { get; set; }

    public Recipe? SavedRecipe { get; set; }
}

public static class RecipeGeneratorStatuses
{
    public const string Draft = "draft";
    public const string Saved = "saved";
    public const string Abandoned = "abandoned";
}
