namespace Domain.Entities;

public class Professor
{
    public int Id { get; private set; }
    public string Name { get; private set; } = string.Empty;

    private readonly List<Subject> _subjects = [];
    public IReadOnlyCollection<Subject> Subjects => _subjects.AsReadOnly();

    private Professor() { }

    public Professor(string name)
    {
        if (string.IsNullOrWhiteSpace(name))
            throw new ArgumentException("Professor name is required", nameof(name));

        Name = name;
    }

    public void AddSubject(Subject subject)
    {
        if (_subjects.Count >= 2)
            throw new InvalidOperationException("A professor can only teach 2 subjects");

        _subjects.Add(subject);
    }
}
