using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CarManagerV3.Classes
{
    internal class CarManufacturer
    {
        public string Name { get; set; }
        public List<string> Models { get; set; } 

        public CarManufacturer(string name)
        {
            Name = name;
            Models = new List<string>();
        }

        public void AddModel(string model)
        {
            Models.Add(model);
        }

        public override string ToString()
        {
            return $"{Name} - Models: {string.Join(", ", Models)}";
        }

        public List<string> GetModels()
        {
            return Models;
        }

        public void RemoveModel(string model)
        {
            Models.Remove(model);
        }

        public void ClearModels()
        {
            Models.Clear();
        }

        public string GetModelByQuery(string query)
        {
            return Models.FirstOrDefault(m => m.Equals(query, StringComparison.OrdinalIgnoreCase));
        }
    }
}
