using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Aberwyn.Models
{
    public class RecipeLabEntry
    {
        [Key]
        public int Id { get; set; }

        [Required]
        public string Title { get; set; }

        public string? Category { get; set; }
        public string? Inspiration { get; set; }

        public int? BaseMealId { get; set; }

        [ForeignKey("BaseMealId")]
        public Meal? BaseMeal { get; set; }

        public string? Notes { get; set; }
        public int? Rating { get; set; } 
        public string? TestedBy { get; set; } 
        public string? Tags { get; set; } // "vego,snabbt"
        public DateTime CreatedAt { get; set; } = DateTime.Now;
        public List<LabIngredient> Ingredients { get; set; } = new();


        public List<RecipeLabVersion> Versions { get; set; } = new();
    }
    public class RecipeLabVersion
    {
        [Key]
        public int Id { get; set; }

        public int RecipeLabEntryId { get; set; }

        [ForeignKey("RecipeLabEntryId")]
        public RecipeLabEntry Entry { get; set; }

        public string VersionLabel { get; set; } = "v1";

        public List<LabVersionIngredient> Ingredients { get; set; } = new();

        public string? Instructions { get; set; }
        public string? ResultNotes { get; set; }
        public DateTime CreatedAt { get; set; } = DateTime.Now;
    }


    public class LabIngredient
    {
        [Key]
        public int Id { get; set; }

        public int RecipeLabEntryId { get; set; }

        [ForeignKey("RecipeLabEntryId")]
        public RecipeLabEntry Entry { get; set; }

        public string Quantity { get; set; } = "";
        public string Item { get; set; } = "";
    }
    public class LabVersionIngredient
    {
        public int Id { get; set; }

        public int RecipeLabVersionId { get; set; }

        [ForeignKey("RecipeLabVersionId")]
        public RecipeLabVersion Version { get; set; }

        public string Quantity { get; set; } = "";
        public string Item { get; set; } = "";
    }


}
