<?php
/**
 * Default WordPress mail provider (no transport override).
 *
 * @package EmailSmtp
 * @since 1.1.0
 */

namespace EmailSmtp\Providers\Wordpress;

use EmailSmtp\Includes\AbstractProvider;
use EmailSmtp\Includes\DeliveryResult;
use EmailSmtp\Includes\EmailMessage;

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

final class Provider extends AbstractProvider {

	public function get_id(): string {
		return 'wordpress';
	}

	public function get_name(): string {
		return __( 'PHP Mail', 'wp-powersuite' );
	}

	public function get_description(): string {
		return __( 'Send through PHP mail() / the server mailer without SMTP or an external API.', 'wp-powersuite' );
	}

	public function get_transport_label(): string {
		return __( 'Built-in', 'wp-powersuite' );
	}

	public function get_recommended_use(): string {
		return __( 'Local or staging sites where deliverability is not critical.', 'wp-powersuite' );
	}

	public function get_docs_url(): string {
		return 'https://developer.wordpress.org/reference/functions/wp_mail/';
	}

	public function get_icon(): string {
		return 'dashicons-wordpress';
	}

	public function get_required_fields(): array {
		return [];
	}

	public function get_connection_status( array $settings ): string {
		unset( $settings );
		return 'connected';
	}

	public function connect( array $settings ): DeliveryResult {
		unset( $settings );
		return DeliveryResult::success(
			__( 'WordPress default mail does not require external credentials.', 'wp-powersuite' )
		);
	}

	public function send( EmailMessage $message, array $settings ): DeliveryResult {
		unset( $message, $settings );
		// Transport is handled by core wp_mail / PHPMailer — router should not call this.
		return DeliveryResult::failure(
			__( 'Default WordPress mail is handled by WordPress core.', 'wp-powersuite' ),
			'wordpress_passthrough',
			'validation'
		);
	}
}
