<?php
namespace R2_Offload\Storage;

use R2_Offload\Logger;
use R2_Offload\Settings;

defined( 'ABSPATH' ) || exit;

/**
 * Resolves the configured provider id to a concrete {@see Storage_Client}.
 */
final class Storage_Factory {

	public static function make( Settings $settings, Logger $logger ): Storage_Client {
		$provider = $settings->provider();
		switch ( Providers::type( $provider ) ) {
			case 'gcs':
				return new GCS_Client( $settings, $logger );
			case 'bunny':
				return new Bunny_Client( $settings, $logger );
			case 's3':
			default:
				return new S3_Compatible_Client( $settings, $logger );
		}
	}
}
