<?php

namespace Drupal\user_provisioning\ProviderSpecific\Parsers;

use Drupal\Core\Entity\EntityInterface;

/**
 * Defines parsers that build provider-specific resource payloads.
 */
interface moResourceParserInterface {

  /**
   * Builds a provider-specific search query for a resource identifier.
   *
   * @param string $resource_id
   *   The unique resource identifier to search.
   *
   * @return string
   *   The provider-specific search query string.
   */
  public function search($resource_id): string;

  /**
   * Builds a provider-specific request payload for GET operations.
   *
   * @param string $resource_id
   *   The unique resource identifier to fetch.
   *
   * @return mixed
   *   The parsed provider-specific request payload.
   */
  public function get($resource_id);

  /**
   * Builds a provider-specific request payload for POST operations.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The Drupal entity to provision.
   *
   * @return mixed
   *   The parsed provider-specific request payload.
   */
  public function post(EntityInterface $entity);

  /**
   * Builds a provider-specific request payload for PUT operations.
   *
   * @param array $resource
   *   The provider resource payload.
   *
   * @return mixed
   *   The parsed provider-specific request payload.
   */
  public function put(array $resource);

  /**
   * Builds a provider-specific request payload for PATCH operations.
   *
   * @param array $resource
   *   The provider resource payload.
   *
   * @return mixed
   *   The parsed provider-specific request payload.
   */
  public function patch(array $resource);

  /**
   * Builds a provider-specific request payload for DELETE operations.
   *
   * @param array $resource
   *   The provider resource payload.
   *
   * @return mixed
   *   The parsed provider-specific request payload.
   */
  public function delete(array $resource);

  /**
   * Builds a provider-specific request payload for deactivation operations.
   *
   * @param \Drupal\Core\Entity\EntityInterface $entity
   *   The Drupal entity to deactivate.
   *
   * @return mixed
   *   The parsed provider-specific request payload.
   */
  public function deactivate(EntityInterface $entity);

}
