<?php
declare( strict_types=1 );

namespace FiboFilters\Integrations\Multilingual;

interface ProviderInterface {
	public function init(): void;

	/**
	 * Check is provider active
	 *
	 * @return bool
	 */
	public function is_active(): bool;

	/**
	 * Get provider name
	 *
	 * @return string
	 */
	public function get_name(): string;

	/**
	 * Get active languages
	 *
	 * @param bool $include_invalid Also return invalid languages.
	 */
	public function get_languages( bool $include_invalid ): array;

	/**
	 * Get current language
	 *
	 * @return string
	 */
	public function get_current_language(): string;

	/**
	 * Get default language
	 *
	 * @return string
	 */
	public function get_default_language(): string;

	/**
	 * Get Language of post or product
	 *
	 * @param int    $post_id Post ID.
	 * @param string $post_type Post type.
	 *
	 * @return string
	 */
	public function get_post_language( int $post_id, string $post_type = 'product' ): string;

	/**
	 * Get term language
	 *
	 * @param int    $term_id Term ID.
	 * @param string $taxonomy Taxonomy slug.
	 *
	 * @return string
	 */
	public function get_term_language( int $term_id, string $taxonomy ): string;

	/**
	 * Get permalink
	 *
	 * @param string $post_id Post ID.
	 * @param string $permalink URL.
	 * @param string $language Language code.
	 * @param string $default_language Default language.
	 *
	 * @return string
	 */
	public function get_permalink( string $post_id, string $permalink = '', string $language = '', string $default_language = '' ): string;

	/**
	 * Get all terms in one taxonomy for all languages
	 *
	 * @param string $taxonomy Taxonomy slug.
	 * @param array  $languages All languages.
	 * @param string $current_language Current language.
	 *
	 * @return \WP_Term[]
	 */
	public function get_terms_in_all_languages( string $taxonomy, array $languages, string $current_language ): array;

	/**
	 * Get terms in specific language
	 *
	 * @param array  $args Get terms arguments.
	 * @param string $language Language code.
	 * @param string $current_language Current language.
	 *
	 * @return \WP_Term[]
	 */
	public function get_terms_in_language( array $args = [], string $language = '', string $current_language = '' ): ?array;

	/**
	 * Get term in specific language
	 *
	 * @param int    $term_id Term ID.
	 * @param string $taxonomy Taxonomy slug.
	 * @param string $language Language code.
	 * @param string $current_language Current language.
	 */
	public function get_term( int $term_id, string $taxonomy, string $language, string $current_language = '' ): ?\WP_Term;

	/**
	 * Switch language
	 *
	 * @param string $language Language code.
	 */
	public function switch_language( string $language = '' ): void;

	/**
	 * Register string for translation
	 */
	public function register_strings_for_translation(): void;

	/**
	 * Perform frontend actions
	 */
	public function perform_frontend_actions(): void;
}
