<?php
/**
 * BookiFlex NotificationLog Extension
 *
 * @package    BookiFlex
 * @subpackage NotificationLog
 * @author     BookiFlex
 * @copyright  Copyright (c) 2025 BookiFlex
 * @license    GPL-2.0-or-later
 *
 * @link       https://bookiflex.com
 */

declare(strict_types=1);

namespace BookiFlex\Extensions\NotificationLog\Api\Request;

use BookiFlex\Core\Api\Request\AbstractRequest;
use WP_REST_Request;

defined('ABSPATH') || exit;

class ResendNotificationRequest extends AbstractRequest
{
    public function __construct(
        private readonly string $sid
    ) {
    }

    public static function fromWpRestRequest(WP_REST_Request $request): self
    {
        return new self(
            sid: (string) $request->get_param('sid')
        );
    }

    public static function getValidationRules(): array
    {
        return [
            'sid' => [
                'required'          => true,
                'type'              => 'string',
                'validate_callback' => 'rest_validate_request_arg',
                'sanitize_callback' => 'sanitize_text_field',
            ],
        ];
    }

    public function getSid(): string
    {
        return $this->sid;
    }
}
