<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Options;

use Automattic\WooCommerce\GoogleListingsAndAds\Value\PositiveInteger;

/**
 * Interface OptionsInterface
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Options
 */
interface OptionsInterface {

	public const ADS_ACCOUNT_CURRENCY                      = 'ads_account_currency';
	public const ADS_ACCOUNT_OCID                          = 'ads_account_ocid';
	public const ADS_ACCOUNT_STATE                         = 'ads_account_state';
	public const ADS_ENHANCED_CONVERSIONS_ENABLED          = 'enhanced_conversions_enabled';
	public const ADS_BILLING_URL                           = 'ads_billing_url';
	public const ADS_HAS_UNCLAIMED_INCENTIVE               = 'ads_has_unclaimed_incentive';
	public const ADS_ID                                    = 'ads_id';
	public const ADS_INCENTIVE_APPLY_ERROR                 = 'ads_incentive_apply_error';
	public const ADS_CONVERSION_ACTION                     = 'ads_conversion_action';
	public const ADS_EU_POLITICAL_DECLARATIONS_COMPLETE    = 'ads_eu_political_declarations_complete';
	public const ADS_SETUP_COMPLETED_AT                    = 'ads_setup_completed_at';
	public const CAMPAIGN_CONVERT_STATUS                   = 'campaign_convert_status';
	public const CLAIMED_URL_HASH                          = 'claimed_url_hash';
	public const CONTACT_INFO_SETUP                        = 'contact_info_setup';
	public const DELAYED_ACTIVATE                          = 'delayed_activate';
	public const DB_VERSION                                = 'db_version';
	public const FILE_VERSION                              = 'file_version';
	public const GOOGLE_CONNECTED                          = 'google_connected';
	public const GOOGLE_WPCOM_AUTH_NONCE                   = 'google_wpcom_auth_nonce';
	public const INSTALL_TIMESTAMP                         = 'install_timestamp';
	public const INSTALL_VERSION                           = 'install_version';
	public const JETPACK_CONNECTED                         = 'jetpack_connected';
	public const MC_SETUP_COMPLETED_AT                     = 'mc_setup_completed_at';
	public const MERCHANT_ACCOUNT_STATE                    = 'merchant_account_state';
	public const MERCHANT_CENTER                           = 'merchant_center';
	public const MERCHANT_ID                               = 'merchant_id';
	public const REDIRECT_TO_ONBOARDING                    = 'redirect_to_onboarding';
	public const SHIPPING_RATES                            = 'shipping_rates';
	public const SHIPPING_TIMES                            = 'shipping_times';
	public const SITE_VERIFICATION                         = 'site_verification';
	public const SYNCABLE_PRODUCTS_COUNT                   = 'syncable_products_count';
	public const SYNCABLE_PRODUCTS_COUNT_INTERMEDIATE_DATA = 'syncable_products_count_intermediate_data';
	public const PRODUCT_STATUSES_COUNT_INTERMEDIATE_DATA  = 'product_statuses_count_intermediate_data';
	public const TARGET_AUDIENCE                           = 'target_audience';
	public const TOURS                                     = 'tours';
	public const UPDATE_ALL_PRODUCTS_LAST_SYNC             = 'update_all_products_last_sync';
	public const WP_TOS_ACCEPTED                           = 'wp_tos_accepted';
	public const WPCOM_REST_API_STATUS                     = 'wpcom_rest_api_status';
	public const GTIN_MIGRATION_STATUS                     = 'gtin_migration_status';
	public const YOUTUBE_ORDER_IDS_CACHE                   = 'youtube_export_order_ids';
	public const YOUTUBE_EXPORT_FILES                      = 'youtube_export_files';
	public const YOUTUBE_THIRD_PARTY_LINK                  = 'youtube_third_party_link';
	public const ONBOARDING_COMPLETED_AT                   = 'onboarding_completed_at';
	public const IS_SERVICE_BASED_MERCHANT                 = 'is_service_based_merchant';

	public const VALID_OPTIONS = [
		self::ADS_ACCOUNT_CURRENCY                      => true,
		self::ADS_ACCOUNT_OCID                          => true,
		self::ADS_ACCOUNT_STATE                         => true,
		self::ADS_ENHANCED_CONVERSIONS_ENABLED          => true,
		self::ADS_BILLING_URL                           => true,
		self::ADS_HAS_UNCLAIMED_INCENTIVE               => true,
		self::ADS_ID                                    => true,
		self::ADS_INCENTIVE_APPLY_ERROR                 => true,
		self::ADS_CONVERSION_ACTION                     => true,
		self::ADS_EU_POLITICAL_DECLARATIONS_COMPLETE    => true,
		self::ADS_SETUP_COMPLETED_AT                    => true,
		self::CAMPAIGN_CONVERT_STATUS                   => true,
		self::CLAIMED_URL_HASH                          => true,
		self::CONTACT_INFO_SETUP                        => true,
		self::DB_VERSION                                => true,
		self::FILE_VERSION                              => true,
		self::GOOGLE_CONNECTED                          => true,
		self::INSTALL_TIMESTAMP                         => true,
		self::INSTALL_VERSION                           => true,
		self::JETPACK_CONNECTED                         => true,
		self::MC_SETUP_COMPLETED_AT                     => true,
		self::MERCHANT_ACCOUNT_STATE                    => true,
		self::MERCHANT_CENTER                           => true,
		self::MERCHANT_ID                               => true,
		self::DELAYED_ACTIVATE                          => true,
		self::SHIPPING_RATES                            => true,
		self::SHIPPING_TIMES                            => true,
		self::REDIRECT_TO_ONBOARDING                    => true,
		self::SITE_VERIFICATION                         => true,
		self::SYNCABLE_PRODUCTS_COUNT                   => true,
		self::SYNCABLE_PRODUCTS_COUNT_INTERMEDIATE_DATA => true,
		self::PRODUCT_STATUSES_COUNT_INTERMEDIATE_DATA  => true,
		self::TARGET_AUDIENCE                           => true,
		self::TOURS                                     => true,
		self::UPDATE_ALL_PRODUCTS_LAST_SYNC             => true,
		self::WP_TOS_ACCEPTED                           => true,
		self::WPCOM_REST_API_STATUS                     => true,
		self::GOOGLE_WPCOM_AUTH_NONCE                   => true,
		self::GTIN_MIGRATION_STATUS                     => true,
		self::YOUTUBE_ORDER_IDS_CACHE                   => true,
		self::YOUTUBE_EXPORT_FILES                      => true,
		self::YOUTUBE_THIRD_PARTY_LINK                  => true,
		self::ONBOARDING_COMPLETED_AT                   => true,
		self::IS_SERVICE_BASED_MERCHANT                 => true,
	];

	public const OPTION_TYPES = [
		self::ADS_ID      => PositiveInteger::class,
		self::MERCHANT_ID => PositiveInteger::class,
	];

	/**
	 * Get an option.
	 *
	 * @param string $name          The option name.
	 * @param mixed  $default_value A default value for the option.
	 *
	 * @return mixed
	 */
	public function get( string $name, $default_value = null );

	/**
	 * Add an option.
	 *
	 * @param string $name  The option name.
	 * @param mixed  $value The option value.
	 *
	 * @return bool
	 */
	public function add( string $name, $value ): bool;

	/**
	 * Update an option.
	 *
	 * @param string $name  The option name.
	 * @param mixed  $value The option value.
	 *
	 * @return bool
	 */
	public function update( string $name, $value ): bool;

	/**
	 * Delete an option.
	 *
	 * @param string $name The option name.
	 *
	 * @return bool
	 */
	public function delete( string $name ): bool;

	/**
	 * Helper function to retrieve the Merchant Account ID.
	 *
	 * @return int
	 */
	public function get_merchant_id(): int;

	/**
	 * Returns all available option keys.
	 *
	 * @return array
	 */
	public static function get_all_option_keys(): array;

	/**
	 * Helper function to retrieve the Ads Account ID.
	 *
	 * @return int
	 */
	public function get_ads_id(): int;
}
