<?php

final class SemiStructuredDataApplication extends PhabricatorApplication {

  const ICON_OBJECT_TYPE = 'fa-camera';
  const ICON_OBJECT_INSTANCE = 'fa-dribbble';
  const ICON_OBJECT_TYPE_MANY = 'fa-todo';
  const ICON_OBJECT_INSTANCE_MANY = 'fa-group';
  const ICON_APPLICATION = 'fa-wpforms';

  public function getName() {
    return pht('Semi-Structured');
  }

  public function getShortDescription() {
    return pht('Work with evolving data sets.');
  }

  public function getIcon() {
    return self::ICON_APPLICATION;
  }

  public function getBaseURI() {
    return '/semistruct/';
  }


  public function getRemarkupRules() {
    // I think I want to use this method to allow classes
    // to define user-provided "RemarkupRule" for their instances.
    return array(
      new SemiStructuredObjectTypeRemarkupRule(),
    );
  }

  public function getRoutes() {
    return array(
        '/semistruct/' => array(
          $this->getQueryRoutePattern() =>
            'SemiStructuredObjectTypeListController',
          $this->getEditRoutePattern('editclass/') =>
            'SemiStructuredObjectTypeEditController',

          'type/(?:(?P<id>\d+)/)?' => array(
            '' => 'SemiStructuredObjectTypeViewController',
            'archive/' => 'SemiStructuredObjectTypeArchiveController',
          ),
          // If the ID field is called `id`, the EditEngine thinks this is
          // editing an existing object.
          'type/(?:(?P<typeid>\d+)/)?' => array(
            'new/' => 'SemiStructuredObjectNewInstanceController',
            'items/' => 'SemiStructuredObjectInstanceListController',
            $this->getQueryRoutePattern() =>
              'SemiStructuredObjectInstanceListController',
          ),

          'instance/' => array(
            $this->getQueryRoutePattern() =>
              'SemiStructuredObjectInstanceListController',
          ),


          $this->getEditRoutePattern('editinstance/') =>
            'SemiStructuredObjectInstanceEditController',
          'instance/(?:(?P<id>\d+)/)?' =>
            'SemiStructuredObjectInstanceViewController',

        ),
    );
  }

}
