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

namespace TIAM.Entities.Products;

[Table("Products")]
public class Product : ProductBase
{
    [Required]
    public Guid ServiceProviderId { get; set; }

    public virtual TiamServiceProvider ServiceProvider { get; set; }

    public virtual List<User> Users { get; } = new();
    public virtual List<UserProductMapping> UserProductMappings { get; } = new();

    public Product(){}

    public Product(Guid ownerId, ProductType productType, string name, string description, float price, string jsonDetails) : this(Guid.NewGuid(), ownerId, productType, name, description, price, jsonDetails) { }
    public Product(Guid id, Guid serviceProviderId, ProductType productType, string name, string description, float price, string jsonDetails) : base(id, productType, name, description, price, jsonDetails)
    {
        ServiceProviderId = serviceProviderId;        
    }
    public Product(Guid ownerId, TiamServiceProvider serviceProvider, ProductType productType, string name, string description, float price, string jsonDetails) : this(Guid.NewGuid(), ownerId, serviceProvider, productType, name, description, price, jsonDetails) { }
    public Product(Guid id, Guid serviceProviderId, TiamServiceProvider serviceProvider, ProductType productType, string name, string description, float price, string jsonDetails) : base(id, productType, name, description, price, jsonDetails)
    {
        ServiceProviderId = serviceProviderId;
        ServiceProvider = serviceProvider;
    }
}