<?php
/**
 * Variable source interface.
 *
 * @package 100Prints
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

interface Hundred_Prints_Variable_Source_Interface {

	/**
	 * Get the machine-readable source key.
	 *
	 * @return string
	 */
	public function get_key();

	/**
	 * Get the human-readable source label.
	 *
	 * @return string
	 */
	public function get_label();

	/**
	 * Get editor field schemas for this source.
	 *
	 * @return array
	 */
	public function get_fields();

	/**
	 * Sanitize one mapping rule for this source.
	 *
	 * @param array $rule Raw mapping rule.
	 * @return array
	 */
	public function sanitize_rule( array $rule );

	/**
	 * Resolve one mapping rule to a value.
	 *
	 * @param array $rule    Sanitized mapping rule.
	 * @param array $context Runtime context.
	 * @return mixed
	 */
	public function resolve( array $rule, array $context );
}
