<?php

namespace Inspire_Labs\Alsendo_Connect\Plugin;

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

/**
 * Request
 */
class Request {

	const METHOD_POST = 'POST';

	const METHOD_GET = 'POST';

	private static $request;

	/**
	 * @var Request_Filter_Interface[]
	 */
	private static $secure_filters = array();

	/**
	 * @var string
	 */
	private $method;

	/**
	 * Get payload
	 */
	public function get_payload(): array {
		if ( null === self::$request ) {
			$this->build();
		}

		return self::$request;
	}

	/**
	 * Register request filter
	 *
	 * @param Request_Filter_Interface $request_filter $request_filter.
	 *
	 * @return void
	 */
	public function register_request_filter(
		Request_Filter_Interface $request_filter
	) {
		if ( ! in_array( $request_filter, self::$secure_filters ) ) {
			self::$secure_filters[] = $request_filter;
		}
	}


	/**
	 * Get by key
	 *
	 * @param string $key $key.
	 *
	 * @return mixed|null
	 */
	public function get_by_key( string $key ) {
	}

	/**
	 * Overwrite
	 *
	 * @param string $key $key.
	 * @param value  $value.
	 *
	 * @return void
	 */
	public function overwrite( string $key, $value ) {
		self::$request[ $key ] = $value;
	}

	public function build(): void {
	}
}
