﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TheSchool.Interfaces;

namespace TheSchool.Models
{
    class School : INameble
    {

        public School(string name)
        {
            this.Classes = new List<SchoolClass>();
            this.Name = name;
        }
        public ICollection<SchoolClass> Classes { get; set; }

        public string Name
        {
            get; private set;
        }

        public void AddClassToSchool(SchoolClass schoolClass)
        {
            this.Classes.Add(schoolClass);
        }

        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendLine($"This school is {this.Name}.");
            sb.AppendLine($"There are {this.Classes.Count} classes at this school. They are:");
            foreach (var schoolClass in this.Classes)
            {
                sb.AppendLine(schoolClass.ToString());
            }

            return sb.ToString();
        }
    }
}
