using FeMM.Grasshopper.DataTypes.FeMM;
using FeMM.Grasshopper.Helpers;
using Grasshopper.Kernel;
using Rhino.Geometry;
using System;
using System.Runtime.Versioning;

namespace FeMM.Grasshopper.Components.Elements
{
#if NETCOREAPP
    [SupportedOSPlatform("windows")]
#endif
    public class NodeComponent : GH_Component
    {
        /// <summary>
        /// Initializes a new instance of the NodeComponent class.
        /// </summary>
        public NodeComponent()
          : base("Node", "N", "Define a Node", CategoryNameConstants.CATEGORY_FEMM, CategoryNameConstants.SUBCATEGORY_ELEMENTS)
        {
        }

        /// <summary>
        /// Registers all the input parameters for this component.
        /// </summary>
        protected override void RegisterInputParams(GH_InputParamManager pManager)
        {
            pManager.AddPointParameter("Point", "P", "The node point coordinate", GH_ParamAccess.item);
        }

        /// <summary>
        /// Registers all the output parameters for this component.
        /// </summary>
        protected override void RegisterOutputParams(GH_OutputParamManager pManager)
        {
            pManager.AddGenericParameter("Node", "N", "The generated node", GH_ParamAccess.item);
        }

        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Point3d point = Point3d.Unset;
            if (!DA.GetData("Point", ref point))
                return;

            DA.SetData("Node", new GH_Node(point));
        }

        public override GH_Exposure Exposure => GH_Exposure.primary;

        /// <summary>
        /// Provides an Icon for the component.
        /// </summary>
        protected override System.Drawing.Bitmap Icon => Properties.Resources.NodeIcon;

        /// <summary>
        /// Gets the unique ID for this component. Do not change this ID after release.
        /// </summary>
        public override Guid ComponentGuid => new("768f9c12-8a9f-4525-8d3a-f33a77793444");
    }
}
303 files24 directories