using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SumaTube.Domain.ValueObjects;

namespace SumaTube.Domain.Entities.UserPlan
{
    public class PersonUser
    {
        public PersonUser(string id, Username username, Name name, Email email,
                    DateChanged dateChanged, bool isProfileCompleted, int countryId,
                    int businessAreaId, string desiredName, DateTime createdAt,
                    UserPayment plano = null, List<UserPayment> pastPlans = null)
        {
            Id = id ?? Guid.NewGuid().ToString("N");
            Username = username;
            Name = name;
            Email = email;
            DateChanged = dateChanged;
            IsProfileCompleted = isProfileCompleted;
            CountryId = countryId;
            BusinessAreaId = businessAreaId;
            DesiredName = desiredName;
            CreatedAt = createdAt;
            Plano = plano;
            PastPlans = pastPlans ?? new List<UserPayment>();
        }

        public Id Id {  get; private set; }
        public Username Username { get; private set; }
        public Name Name { get; private set; }
        public string FirstName => Name.FirstName;
        public string LastName => Name.LastName;
        public Email Email { get; private set; }
        public DateChanged DateChanged { get; private set; }
        public bool IsProfileCompleted { get; private set; }
        public int CountryId { get; private set; }
        public int BusinessAreaId { get; private set; }
        public string DesiredName { get; private set; }
        public DateTime CreatedAt { get; private set; }
        public UserPayment? Plano { get; private set; }
        public List<UserPayment>? PastPlans { get; private set; }

        public PersonUser AddPlano(UserPayment plano)
        {
            if (plano == null) throw new ArgumentNullException(nameof(plano));
            PastPlans.Add(plano);
            return this;
        }


    }
}
