<?php
/**
 * app/controllers/houdini.php
 *
 * This is the houdini controller.
 *
 * @version 3.0
 * @author  Joey Kimsey <Joey@thetempusproject.com>
 * @link    https://TheTempusProject.com
 * @license https://opensource.org/licenses/MIT [MIT LICENSE]
 */
namespace TheTempusProject\Controllers;

use TheTempusProject\Hermes\Functions\Redirect;
use TheTempusProject\Houdini\Classes\Views;
use TheTempusProject\Classes\Controller;

class Libraries extends Controller {
    public function index() {
        self::$title = 'Libraries - {SITENAME}';
        self::$pageDescription = '{SITENAME} depends on several very important libraries, some of which are developed exclusively to support the project. Here you can find a list with more information.' ;
        Views::view( 'deps.index' );
    }

    public function ttp( $method = null ) {
        self::$title = '{SITENAME} - TheTempusProject';
        self::$pageDescription = 'TheTempusProject is the primary repo of {SITENAME} which houses the main application.';
        if ( empty( $method ) ) {
            return Views::view( 'deps.ttp' );
        }
        switch ( $method ) {
            case 'git':
                return Redirect::external( 'https://git.thetempusproject.com/the-tempus-project/thetempusproject' );
            case 'packagist':
                return Redirect::external( 'https://packagist.org/packages/thetempusproject/thetempusproject' );
            case 'changes':
                self::$title .= ' Changes';
                self::$pageDescription = 'This pages lists the most recent changes to TheTempusProject with some details on those changes.';
                return Views::view( 'changes.ttp' );
            default:
                return Views::view( 'deps.ttp' );
        }
    }

    public function hermes( $method = null ) {
        self::$title = '{SITENAME} - Hermes';
        self::$pageDescription = 'Hermes is a dependency of {SITENAME} that provides many common helper functions for navigating url components and file systems; designed to work seamlessly regardless of architecture.';
        if ( empty( $method ) ) {
            return Views::view( 'deps.hermes' );
        }
        switch ( $method ) {
            case 'git':
                return Redirect::external( 'https://git.thetempusproject.com/the-tempus-project/hermes' );
            case 'packagist':
                return Redirect::external( 'https://packagist.org/packages/thetempusproject/hermes' );
            case 'changes':
                self::$title .= ' Changes';
                self::$pageDescription = 'Hermes is a dependency of {SITENAME} and this pages lists the most recent changes with some details on those changes.';
                return Views::view( 'changes.hermes' );
            default:
                return Views::view( 'deps.hermes' );
        }
    }

    public function canary( $method = null ) {
        self::$title = '{SITENAME} - Canary';
        self::$pageDescription = 'Canary is a dependency of {SITENAME} that both records and reports logs from various PHP applications.';
        if ( empty( $method ) ) {
            return Views::view( 'deps.canary' );
        }
        switch ( $method ) {
            case 'git':
                return Redirect::external( 'https://git.thetempusproject.com/the-tempus-project/canary' );
            case 'packagist':
                return Redirect::external( 'https://packagist.org/packages/thetempusproject/canary' );
            case 'changes':
                self::$title .= ' Changes';
                self::$pageDescription = 'Canary is a dependency of {SITENAME} and this pages lists the most recent changes with some details on those changes.';
                return Views::view( 'changes.canary' );
            default:
                return Views::view( 'deps.canary' );
        }
    }

    public function bedrock( $method = null ) {
        self::$title = '{SITENAME} - Bedrock';
        self::$pageDescription = 'Bedrock is a dependency of {SITENAME} that provides many components used to manipulate database data and many helper functions vital for running the entire application.';
        if ( empty( $method ) ) {
            return Views::view( 'deps.bedrock' );
        }
        switch ( $method ) {
            case 'git':
                return Redirect::external( 'https://git.thetempusproject.com/the-tempus-project/bedrock' );
            case 'packagist':
                return Redirect::external( 'https://packagist.org/packages/thetempusproject/bedrock' );
            case 'changes':
                self::$title .= ' Changes';
                self::$pageDescription = 'Bedrock is a dependency of {SITENAME} and this pages lists the most recent changes with some details on those changes.';
                return Views::view( 'changes.bedrock' );
            default:
                return Views::view( 'deps.bedrock' );
        }
    }

    public function houdini( $method = null ) {
        self::$title = '{SITENAME} - Houdini';
        self::$pageDescription = 'Houdini is a dependency of {SITENAME} that allows for the creation and manipulation of objects used in html page creation.';
        if ( empty( $method ) ) {
            return Views::view( 'deps.houdini' );
        }
        switch ( $method ) {
            case 'git':
                return Redirect::external( 'https://git.thetempusproject.com/the-tempus-project/houdini' );
            case 'packagist':
                return Redirect::external( 'https://packagist.org/packages/thetempusproject/houdini' );
            case 'changes':
                self::$title .= ' Changes';
                self::$pageDescription = 'Houdini is a dependency of {SITENAME} and this pages lists the most recent changes with some details on those changes.';
                return Views::view( 'changes.houdini' );
            default:
                return Views::view( 'deps.houdini' );
        }
    }
}

