<?php

namespace GermanAirlinesVa\Graphql\Classes;

use Cms\Classes\Theme;

class Schema extends Theme
{
  /**
   * Returns the absolute theme path.
   * @param  string $dirName Optional theme directory. Defaults to $this->getDirName()
   * @return string
   */
  public function getPath(?string $dirName = null): string
  {
    if (!$dirName) {
      $dirName = $this->getDirName();
    }
    return base_path() . '/' . $dirName;
  }

  /**
   * Returns a list of graphs in the template.
   * @param boolean $skipCache Indicates if the pages should be reloaded from the disk bypassing the cache.
   * @return array Returns an array of Nocio\Headstart\Classes\Graph objects.
   */
  public function listGraphs($skipCache = false)
  {
    return Graph::listInTheme($this, $skipCache);
  }

  /**
   * Returns the active theme code.
   *
   * @return string
   * If the theme doesn't exist, returns null.
   */
  public static function getActiveThemeCode(): ?string
  {
    return 'graphql';
  }
}
