<?php

namespace Drupal\user_provisioning\Helpers;

use Drupal\Core\Render\Markup;

/**
 * Provides provider list markup for SCIM server setup.
 */
class moSCIMServer {
  /**
   * Module image assets URL path.
   *
   * @var string
   */
  private string $urlPath;

  /**
   * Constructor for the Provider Specific Provisioning tab.
   */
  public function __construct() {
    $base_url = \Drupal::request()->getSchemeAndHttpHost() . \Drupal::request()->getBaseUrl();
    $this->urlPath = $base_url . '/' . \Drupal::service('extension.list.module')->getPath('user_provisioning') . '/images';
  }

  /**
   * Returns server providers for rendering in setup UI.
   *
   * @return array
   *   The rendered provider list.
   */
  public function providerList($custom = FALSE): array {
    if ($custom == 'custom') {
      return [
        Markup::create('<img class="mo_user_provisioning_img_logo" alt="Custom App" src="' . $this->urlPath . '/customapp.png" ><br><strong>Custom App</strong> '),
      ];
    }
    else {
      return [
        Markup::create('<img class="mo_user_provisioning_img_logo" alt="Custom server" src="' . $this->urlPath . '/customapp.png" ><br><strong>Custom Server</strong> '),
        Markup::create('<img class="mo_user_provisioning_img_logo" alt="AWS SSO" src="' . $this->urlPath . '/AWS.png" ><br><strong>AWS SSO</strong> '),
        Markup::create('<img class="mo_user_provisioning_img_logo" alt="Drupal" src="' . $this->urlPath . '/Drupal.png" ><br><strong>Drupal</strong> '),
        Markup::create('<img class="mo_user_provisioning_img_logo" alt="Okta" src="' . $this->urlPath . '/okta.png"><br><strong>Okta</strong> '),
        Markup::create('<img class="mo_user_provisioning_img_logo" alt="Azure" src="' . $this->urlPath . '/azure.png" ><br><strong>Azure</strong> '),
        Markup::create('<img class="mo_user_provisioning_img_logo" alt="OneLogin" src="' . $this->urlPath . '/onelogin.png" ><br><strong>OneLogin</strong> '),
        Markup::create('<img class="mo_user_provisioning_img_logo" alt="Google" src="' . $this->urlPath . '/google.png" ><br><strong>Google Apps</strong> '),
        Markup::create('<img class="mo_user_provisioning_img_logo" alt="JumpCloud" src="' . $this->urlPath . '/jumpcloud.png" ><br><strong>JumpCloud</strong> '),
        Markup::create('<img class="mo_user_provisioning_img_logo" alt="Centrify" src="' . $this->urlPath . '/centrify.png" ><br><strong>Centrify</strong> '),
        Markup::create('<img class="mo_user_provisioning_img_logo" alt="PingOne" src="' . $this->urlPath . '/pingone.png" ><br><strong>PingOne</strong> '),
        Markup::create('<img class="mo_user_provisioning_img_logo" alt="Miniornage" src="' . $this->urlPath . '/miniorange.png" ><br><strong>miniOrange</strong> '),
        Markup::create('<img class="mo_user_provisioning_img_logo" alt="CyberArk" src="' . $this->urlPath . '/cyberark.png" ><br><strong>Cyberark</strong> '),
        Markup::create('<img class="mo_user_provisioning_img_logo" alt="Wordpress" src="' . $this->urlPath . '/wordpress.png"><br><strong>Wordpress</strong> '),
        Markup::create('<img class="mo_user_provisioning_img_logo" alt="Joomla" src="' . $this->urlPath . '/Joomla.png" ><br><strong>Joomla</strong> '),
      ];
    }
  }

}
