using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using AyCode.Interfaces.Entities;
using AyCode.Interfaces.Profiles;
using AyCode.Interfaces.TimeStampInfo;
using TIAM.Core.Enums;
using TIAM.Entities.Profiles;

namespace TIAM.Entities.Products;


public abstract class ProductBase : IEntityGuid, ITimeStampInfo, IProfileRelation
{
    [Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
    public Guid Id { get; set; }

    [Required]
    public ProductType ProductType { get; set; }
    //public Guid? UserMediaId { get; set; }

    [Required]
    public Guid ProfileId { get; set; }
    [ForeignKey(nameof(ProfileId))]
    public virtual Profile Profile { get; set; }
    
    public string Name { get; set; }
    public string Description { get; set; }
    public float Price { get; set; }
    public string? JsonDetails { get; set; }

    public DateTime Created { get; set; }
    public DateTime Modified { get; set; }

    protected ProductBase(){}

    protected ProductBase(Guid id, ProductType type, string name, string description, float price, string jsonDetails)
    {
        Id = id;
        ProductType = type;
        //UserMediaId = userMediaId;
        Name = name;
        Description = description;
        Price = price;
        JsonDetails = jsonDetails;
        Created = DateTime.Now;
        Modified = DateTime.Now;        
    }
}