<?php
/**
 * Mailer Provider class.
 *
 * @since 1.0.0
 *
 * @package smtp
 * @subpackage mailer
 */

namespace DoubleScale\Modules\Smtp\Mailer\Provider;

defined( 'ABSPATH' ) || exit;

use DoubleScale\Modules\Smtp\Mailer\Mailer;

/**
 * Mailer Provider Class.
 *
 * @since 1.0.0
 */
class Provider extends Mailer {

	/**
	 * Account.
	 *
	 * @since 1.0.0
	 *
	 * @var Accounts
	 */
	public $accounts;

	/**
	 * Class names
	 *
	 * @var array
	 */
	protected static $classes = array(
		// + classes from parent.
		// 'accounts'             => Accounts::class,
		// 'process'              => Process::class,
	);

	protected function init() {
		parent::init();

		if ( ! empty( static::$classes['accounts'] ) ) {
			$this->accounts = new static::$classes['accounts']( $this );
		}
	}

	/**
	 * Process.
	 *
	 * @since 1.0.0
	 *
	 * @param \PHPMailer\PHPMailer\PHPMailer $phpmailer PHPMailer.
	 * @param string                         $connection_id Connection id.
	 * @param array                          $connection Connection.
	 *
	 * @return Process
	 */
	public function process( $phpmailer, $connection_id, $connection ) {
		$class = static::$classes['process'];

		return new $class( $this, $phpmailer, $connection_id, $connection );
	}
}
