<?php

final class SemiStructuredObjectTypePHIDType extends PhabricatorPHIDType {

  const TYPECONST = 'SSCL';

  public function getTypeName() {
    return pht('Object Type');
  }

  public function newObject() {
    return new SemiStructuredObjectType();
  }

  public function getPHIDTypeApplicationClass() {
    return 'SemiStructuredDataApplication';
  }

  protected function buildQueryForObjects(
    PhabricatorObjectQuery $query,
    array $phids) {

    return id(new SemiStructuredObjectTypeQuery())
      ->withPHIDs($phids);
  }

  public function loadHandles(
    PhabricatorHandleQuery $query,
    array $handles,
    array $objects) {

    foreach ($handles as $phid => $handle) {
      $item = $objects[$phid];

      $id = $item->getID();

      $handle->setName($item->getName());
      $handle->setURI($item->getURI());
    }
  }

}
