<?php

namespace Drupal\user_provisioning\Helpers;

use Drupal\Core\Render\Markup;
use Drupal\user_provisioning\moUserProvisioningConstants;

/**
 * Provides provider lists for SCIM client configuration.
 */
class moSCIMClient {
  /**
   * Module image assets URL path.
   *
   * @var string
   */
  private string $urlPath;
  /**
   * Base URL of the Drupal site.
   *
   * @var string
   */
  private string $baseUrl;

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

  /**
   * Returns provider cards for the provisioning tab.
   *
   * @return array
   *   The rendered provider list.
   */
  public function providerList($custom = FALSE): array {
    $tab_url = $this->baseUrl . moUserProvisioningConstants::USER_PROVISIONING;

    if ($custom == 'custom') {
      return [
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/custom"><div><img class="mo_user_provisioning_img_logo" alt="Custom App" src="' . $this->urlPath . '/customapp.png" ><br><strong>Custom Provider</strong></div></a>'),
      ];
    }
    else {
      return [
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/aws_sso"><div><img class="mo_user_provisioning_img_logo" alt="AWS SSO" src="' . $this->urlPath . '/AWS.png" ><br><strong>AWS SSO</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/azure_ad"><div><img class="mo_user_provisioning_img_logo" alt="Azure AD" src="' . $this->urlPath . '/azure.png" ><br><strong>Azure Active Directory</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/okta"><div><img class="mo_user_provisioning_img_logo" alt="Okta" src="' . $this->urlPath . '/okta.png" ><br><strong>Okta</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/onelogin"><div><img class="mo_user_provisioning_img_logo" alt="OneLogin" src="' . $this->urlPath . '/onelogin.png" ><br><strong>OneLogin</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/google"><div><img class="mo_user_provisioning_img_logo" alt="Google Apps" src="' . $this->urlPath . '/google.png" ><br><strong>Google Apps</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/cyberark"><div><img class="mo_user_provisioning_img_logo" alt="CyberArk" src="' . $this->urlPath . '/cyberark.png" ><br><strong>CyberArk</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/miniorange"><div><img class="mo_user_provisioning_img_logo" alt="miniOrange" src="' . $this->urlPath . '/miniorange.png" ><br><strong>miniOrange</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/jumpcloud"><div><img class="mo_user_provisioning_img_logo" alt="JumpCloud" src="' . $this->urlPath . '/jumpcloud.png" ><br><strong>JumpCloud</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/ping"><div><img class="mo_user_provisioning_img_logo" alt="PingOne" src="' . $this->urlPath . '/pingone.png" ><br><strong>PingOne</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/centrify"><div><img class="mo_user_provisioning_img_logo" alt="Centrify" src="' . $this->urlPath . '/centrify.png" ><br><strong>Centrify</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/salesforce"><div><img class="mo_user_provisioning_img_logo" alt="Salesforce" src="' . $this->urlPath . '/salesforce.png" ><br><strong>Salesforce</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/oracle"><div><img class="mo_user_provisioning_img_logo" alt="Oracle" src="' . $this->urlPath . '/oracle.png" ><br><strong>Oracle</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/drupal"><div><img class="mo_user_provisioning_img_logo" alt="Drupal" src="' . $this->urlPath . '/Drupal.png" ><br><strong>Drupal</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/joomla"><div><img class="mo_user_provisioning_img_logo" alt="Joomla" src="' . $this->urlPath . '/Joomla.png" ><br><strong>Joomla</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/wordpress"><div><img class="mo_user_provisioning_img_logo" alt="WordPress" src="' . $this->urlPath . '/wordpress.png" ><br><strong>WordPress</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/alexis"><div><img class="mo_user_provisioning_img_logo" alt="AlexisHR" src="' . $this->urlPath . '/alexis.png" ><br><strong>AlexisHR Provisioning</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/anaplan"><div><img class="mo_user_provisioning_img_logo" alt="Anaplan" src="' . $this->urlPath . '/anaplan.png" ><br><strong>Anaplan SCIM API</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/blink"><div><img class="mo_user_provisioning_img_logo" alt="Blink" src="' . $this->urlPath . '/blink.png" ><br><strong>Blink</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/calendly"><div><img class="mo_user_provisioning_img_logo" alt="Calendly" src="' . $this->urlPath . '/calendly.png" ><br><strong>Calendly</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/circlehd"><div><img class="mo_user_provisioning_img_logo" alt="CircleHD" src="' . $this->urlPath . '/circleHD.png" ><br><strong>CircleHD</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/curity"><div><img class="mo_user_provisioning_img_logo" alt="Curity" src="' . $this->urlPath . '/curity.png" ><br><strong>Curity Identity Server</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/federated_dir"><div><img class="mo_user_provisioning_img_logo" alt="Federated Directory" src="' . $this->urlPath . '/federated_directory.png" ><br><strong>Federated Directory</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/fusionauth"><div><img class="mo_user_provisioning_img_logo" alt="FusionAuth" src="' . $this->urlPath . '/fusionauth.png" ><br><strong>FusionAuth</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/github"><div><img class="mo_user_provisioning_img_logo" alt="GitHub" src="' . $this->urlPath . '/github.png" ><br><strong>GitHub Business</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/idaas"><div><img class="mo_user_provisioning_img_logo" alt="Idaas.nl" src="' . $this->urlPath . '/idaas.png" ><br><strong>idaas.nl</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/monokee"><div><img class="mo_user_provisioning_img_logo" alt="Monokee" src="' . $this->urlPath . '/monokee.png" ><br><strong>Monokee</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/netiq"><div><img class="mo_user_provisioning_img_logo" alt="NetIQ" src="' . $this->urlPath . '/netiq.png" ><br><strong>NetIQ Identity Manager</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/workday"><div><img class="mo_user_provisioning_img_logo" alt="Workday Peakon" src="' . $this->urlPath . '/workday.png" ><br><strong>Workday Peakon</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/reward"><div><img class="mo_user_provisioning_img_logo" alt="Reward Gateway" src="' . $this->urlPath . '/rewardgateway.png" ><br><strong>Reward Gateway</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/sailpoint"><div><img class="mo_user_provisioning_img_logo" alt="Reward Gateway" src="' . $this->urlPath . '/sailpoint.png" ><br><strong>SailPoint</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/sap"><div><img class="mo_user_provisioning_img_logo" alt="Reward Gateway" src="' . $this->urlPath . '/sap.png" ><br><strong>SAP</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/trello"><div><img class="mo_user_provisioning_img_logo" alt="Trello" src="' . $this->urlPath . '/trello.png" ><br><strong>Trello</strong></div></a>'),
        Markup::create('<a class="use-ajax" href="' . $tab_url . '/configure_app/wso2"><div><img class="mo_user_provisioning_img_logo" alt="AWS SSO" src="' . $this->urlPath . '/wso2.png" ><br><strong>WSO2 Charon</strong></div></a>'),
      ];
    }
  }

}
