using System;
using UnityEngine;

namespace pdinklag.CPW.Common
{
    [Serializable]
    public struct WrestlerStats
    {
        public static int ComputeOverall(float strength, float stamina, float speed, float toughness, float skill, float charisma)
            => (int)(100.0f * (strength + stamina + speed + toughness + skill + charisma) / 6.0f);

        public static WrestlerStats Default => new()
        {
            Weight = 100,
            WeightDisplayUnit = pdinklag.Weight.Unit.Pounds,
            Height = 2.00f,
            HeightDisplayUnit = pdinklag.Height.Unit.FeetAndInches,
            Strength = 0.5f,
            Stamina = 0.5f,
            Speed = 0.5f,
            Toughness = 0.5f,
            Skill = 0.5f,
            Charisma = 0.5f
        };

        [Header("Physical Properties")]
        [Tooltip("The wrestler's height in meters (disregarding the display unit).")]
        public float Height;

        [Tooltip("The display unit for the wrestler's height.")]
        public Height.Unit HeightDisplayUnit;

        [Tooltip("The wrestler's weight in kilograms (disregarding the display unit).")]
        public float Weight;

        [Tooltip("The display unit for the wrestler's weight.")]
        public Weight.Unit WeightDisplayUnit;

        [Header("Stats")]
        [Tooltip("Strength (1 = flips over ambulances, 0 = can barely benchpress the mere bar).")]
        [Range(0, 1)]
        public float Strength;

        [Tooltip("Stamina (1 = can run a marathon, 0 = gets gassed within few minutes).")]
        [Range(0, 1)]
        public float Stamina;

        [Tooltip("Speed (1 = leopard, 0 = snail).")]
        [Range(0, 1)]
        public float Speed;

        [Tooltip("Toughness (1 = tough as a brick, 0 = gets knocked out by a fly landing on 'em).")]
        [Range(0, 1)]
        public float Toughness;

        [Tooltip("Skill (1 = wrestles a broom to a good match, 0 = Botchamania regular).")]
        [Range(0, 1)]
        public float Skill;

        [Tooltip("Charisma (1 = draws energy from taunts and the audience, 0 = never draws a dime) - NOT a face/heel measure.")]
        [Range(0, 1)]
        public float Charisma;

        public readonly int Overall => ComputeOverall(Strength, Stamina, Speed, Toughness, Skill, Charisma);
    }
}
