﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Esmiylara.Database.Structures;
using Esmiylara.Enumerations;

namespace Esmiylara.Database
{
    public class Actor : DataObject
    {
        public Vitals Vitals;
        public Shields Shields;
        public Stats Stats;
        public Location Location;

        public Actor()
        {
            Vitals = new Vitals();
            Shields = new Shields();
            Stats = new Stats();
            Location = new Location();

            foreach(Vital vital in Enum.GetValues(typeof(Vital)))
            {
                SetVital(vital, GetMaxVital(vital));
            }
        }

        public virtual int GetVital(Vital vital)
        {
            switch (vital)
            {
                case Vital.Health:
                    return Vitals.Health;
                case Vital.Elementum:
                    return Vitals.Elementum;
                case Vital.Stamina:
                    return Vitals.Stamina;
            }

            return 0;
        }

        public virtual void SetVital(Vital vital, int value)
        {
            switch (vital)
            {
                case Vital.Health:
                    Vitals.Health = value;
                    break;
                case Vital.Elementum:
                    Vitals.Elementum = value;
                    break;
                case Vital.Stamina:
                    Vitals.Stamina = value;
                    break;
            }
        }

        public virtual int GetMaxVital(Vital vital)
        {
            switch (vital)
            {
                case Vital.Health:
                    return (10 + Stats.Endurance);
                case Vital.Elementum:
                    return (10 + Stats.Intelligence);
                case Vital.Stamina:
                    return (10 + Stats.Agility);
            }

            return 0;
        }
    }
}
