using System;

namespace ContactManagementSystem.Models
{
    /// <summary>
    /// Base class representing a person with basic information
    /// Demonstrates: Encapsulation, Property Validation, Virtual Methods
    /// </summary>
    public class Person
    {
        private string _firstName; // hidden and private to the class
        private string _lastName;

       public string FirstName
        {
            get => _firstName;
            set
            {
               _firstName = value.Trim();
            }
        }

       public string LastName
        {
            get => _lastName;
            set
            {
                _lastName = value.Trim();
            }
        }

        #region Constructors

        /// <summary>
        /// Default constructor
        /// </summary>
        public Person()
        {
        }

        public Person(string firstName, string lastName)
        {
            FirstName = firstName;  // Uses property setter with validation
            LastName = lastName ;     // Uses property setter with validation
        }

        #endregion

        public virtual string GetFullName()
        {
           string fullName = $"{FirstName} {LastName}"; // value
            return fullName; // must match or apply to method type
        }

        public virtual void DisplayInfo()
        {            
            string obj1 = $"Name: {GetFullName()}";
            Console.WriteLine(obj1);
        }

        public override string ToString() // Person.ToString()
        {
            return GetFullName();
        }

       
    }
}
