using Avalonia.Input;
using Avalonia.Media;
using TraceCad.Core.Geometry;

namespace TraceCad.App.Tools;

public sealed class SelectTool : ISketchTool
{
    public string Name => "Select";

    public string Prompt => "Select Tool: choose an entity";

    public void PointerDown(ToolContext context, Point2 modelPoint)
    {
        context.SetSelected(context.HitTest(modelPoint, 6.0));
        context.SetStatus(context.SelectedEntity is null ? Prompt : "Select Tool: entity selected");
        context.Invalidate();
    }

    public void PointerMove(ToolContext context, Point2 modelPoint)
    {
    }

    public void PointerUp(ToolContext context, Point2 modelPoint)
    {
    }

    public void KeyDown(ToolContext context, Key key)
    {
    }

    public void Cancel(ToolContext context)
    {
        context.SetSelected(null);
        context.SetStatus(Prompt);
        context.Invalidate();
    }

    public void RenderOverlay(DrawingContext context, ToolRenderContext renderContext)
    {
    }
}
