<?php
declare(strict_types=1);

namespace ROITheme\Shared\Application\UseCases\DeleteComponent;

/**
 * DeleteComponentResponse - DTO de respuesta para eliminación
 *
 * @package ROITheme\Shared\Application\UseCases\DeleteComponent
 */
final readonly class DeleteComponentResponse
{
    private function __construct(
        private bool $success,
        private ?string $message,
        private ?string $error
    ) {}

    public function isSuccess(): bool
    {
        return $this->success;
    }

    public function getMessage(): ?string
    {
        return $this->message;
    }

    public function getError(): ?string
    {
        return $this->error;
    }

    public static function success(string $message): self
    {
        return new self(true, $message, null);
    }

    public static function failure(string $error): self
    {
        return new self(false, null, $error);
    }

    public function toArray(): array
    {
        return [
            'success' => $this->success,
            'message' => $this->message,
            'error' => $this->error
        ];
    }
}
