using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace Entities.Contracts
{
    [Table("schools")]
    public class School
    {
        [Key]
        [Column("id")]
        public Guid Id { get; set; }

        [Column("school_name")]
        [MaxLength(50)]
        public string SchoolName { get; set; }

        [Column("address")]
        [MaxLength(100)]
        public string Address { get; set; }

        [Column("create_time")]
        public DateTime CreateTime { get; set; }

        [InverseProperty(nameof(Grade.School))]
        public virtual ICollection<Grade> Grades { get; set; }

        public School()
        {
            Id = Guid.NewGuid();
            Grades = new HashSet<Grade>();
            CreateTime = DateTime.Now;
        }
    }
}
