﻿using System.Collections.Generic;

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace SuperHeroesModels
{
    public class Fraction
    {
        private ICollection<SuperHero> superHeroes;
        private ICollection<Planet> planets;
        public Fraction()
        {
            this.superHeroes = new HashSet<SuperHero>();
            this.planets = new HashSet<Planet>();
        }

        [Key]
        public int Id { get; set; }

        [MinLength(2)]
        [MaxLength(30)]
        [Index(IsUnique = true)]
        [Required]
        public string Name { get; set; }
        
        public AlignmentTypes Alignment { get; set; }


        public virtual ICollection<Planet> Planets
        {
            get
            {
                return this.planets;
            }
            set
            {
                this.planets = value;
            }
        }
        public virtual ICollection<SuperHero> SuperHeroes
        {
            get
            {
                return this.superHeroes;
            }
            set
            {
                this.superHeroes = value;
            }
        }

        
    }
}
