<?php

declare(strict_types=1);

namespace App\Framework\Console\Components;

/**
 * Mouse event value object
 */
final readonly class MouseEvent
{
    public function __construct(
        public int $x,
        public int $y,
        public int $button,
        public bool $pressed,
        public bool $shift = false,
        public bool $ctrl = false,
        public bool $alt = false
    ) {
    }

    /**
     * Get human-readable button name
     */
    public function getButtonName(): string
    {
        return match ($this->button) {
            0 => 'Left',
            1 => 'Middle',
            2 => 'Right',
            64 => 'Scroll Up',
            65 => 'Scroll Down',
            default => 'Unknown',
        };
    }

    /**
     * Check if this is a scroll event
     */
    public function isScrollEvent(): bool
    {
        return in_array($this->button, [64, 65], true);
    }
}

