﻿using System;
using System.Collections.Generic;
using SpecificationMain;

namespace Game.Domain
{
    public sealed class Race
    {
        private readonly string _name;
        private readonly IReadOnlyCollection<Modifier> _modifiers;
        private readonly Specification<Weapon> _weaponUsageSpecification;

        public Race(string name, Specification<Weapon> weaponUsageSpecification, params Modifier[] modifiers)
        {
            if (name == null) throw new ArgumentNullException("name");
            if (weaponUsageSpecification == null) throw new ArgumentNullException("weaponUsageSpecification");
            if (modifiers == null) throw new ArgumentNullException("modifiers");

            _name = name;
            _weaponUsageSpecification = weaponUsageSpecification;
            _modifiers = modifiers;
        }

        public string Name
        {
            get { return _name; }
        }

        public IEnumerable<Modifier> Modifiers
        {
            get { return _modifiers; }
        }

        public IUnit CreateUnit()
        {
            return new Unit(this,
                new CharacteristicSet(
                    new Characteristic(Characteristics.Health),
                    new Characteristic(Characteristics.Attack)),
                new FeatureSet(),
                _weaponUsageSpecification);
        }
    }
}