import AbstractMenuBuilder from '~/services/layout/menuBuilder/abstractMenuBuilder'
import {MenuItem} from "~/types/layout";
import {MENU_LINK_TYPE} from "~/types/enum/layout";

/**
 * Menu Site internet
 */
export default class WebsiteAdminMenuBuilder extends AbstractMenuBuilder {
  static readonly menuName = "WebsiteAdmin"

  /**
   * Construit le menu Site internet, ou null si aucune page accessible
   */
  build(): MenuItem | null {
    if (this.organizationProfile.website && this.accessProfile.isAdminAccess) {
      const url = this.organizationProfile.website + '/typo3'
      return this.createItem('advanced_modification', {name: 'fas fa-globe-americas'}, url, MENU_LINK_TYPE.EXTERNAL)
    }

    return null
  }
}
