using Content.Server.Power.EntitySystems;
using Content.Shared.Tools;
using Robust.Shared.Analyzers;
using Robust.Shared.GameObjects;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;

namespace Content.Server.Power.Components
{
    /// <summary>
    ///     Allows the attached entity to be destroyed by a cutting tool, dropping a piece of cable.
    /// </summary>
    [RegisterComponent]
    [Friend(typeof(CableSystem))]
    public sealed class CableComponent : Component
    {
        [DataField("cableDroppedOnCutPrototype", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
        public readonly string CableDroppedOnCutPrototype = "CableHVStack1";

        [DataField("cuttingQuality", customTypeSerializer:typeof(PrototypeIdSerializer<ToolQualityPrototype>))]
        public string CuttingQuality = "Cutting";

        /// <summary>
        ///     Checked by <see cref="CablePlacerComponent"/> to determine if there is
        ///     already a cable of a type on a tile.
        /// </summary>
        [DataField("cableType")]
        public CableType CableType = CableType.HighVoltage;

        [DataField("cuttingDelay")]
        public float CuttingDelay = 0.25f;
    }

    public enum CableType
    {
        HighVoltage,
        MediumVoltage,
        Apc,
    }
}
