<?php
/**
 * Storage Driver Interface
 *
 * @package Ugcify\Storage
 */

namespace Ugcify\Storage;

use WP_Error;

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

/**
 * Interface StorageDriverInterface
 *
 * Any storage backend (S3, GCS, Azure Blob, local) must implement this.
 * PHP 7.4 compatible — no union types or named arguments.
 */
interface StorageDriverInterface {

	/**
	 * Whether this driver is active and fully configured.
	 *
	 * @return bool
	 */
	public function is_enabled();

	/**
	 * Upload a file to remote storage.
	 *
	 * @param array  $file        $_FILES-style entry with keys: name, tmp_name, type.
	 * @param int    $product_id  WooCommerce product ID (used in storage path).
	 * @param string $product_sku WooCommerce product SKU (used in storage path).
	 * @return array|WP_Error On success: { url, key, type, name }. On failure: WP_Error.
	 */
	public function upload( array $file, $product_id, $product_sku );

	/**
	 * Generate a pre-signed URL for browser-direct upload.
	 *
	 * @param string $filename     Original file name.
	 * @param string $content_type MIME type.
	 * @param int    $product_id   WooCommerce product ID.
	 * @param string $product_sku  WooCommerce product SKU.
	 * @return array|WP_Error On success: { upload_url, public_url, key }. On failure: WP_Error.
	 */
	public function get_presigned_url( $filename, $content_type, $product_id, $product_sku );

	/**
	 * Delete a stored object by its key/path.
	 *
	 * @param string $key Storage object key.
	 * @return true|WP_Error
	 */
	public function delete( $key );

	/**
	 * Test connectivity and credentials.
	 *
	 * @return true|WP_Error
	 */
	public function test_connection();
}
