<?php

/**
 * @file
 * Provides a nodequeue service.
 *
 * @author Greg Harvey - http://www.drupaler.co.uk
 */

/**
 * Implements hook_permission().
 */
function nodequeue_service_permission() {
  return array(
    'get nodequeues' => array(
      'title' => t('Get nodequeues'),
      'description' => t('TODO Add a description for get nodequeues'),
    ),
  );
}

/**
 * Implements hook_service().
 */
function nodequeue_service_service() {
  return array(
    array(
      '#method'   => 'nodequeue.getQueues',
      '#callback' => 'nodequeue_service_get_nodequeues',
      '#access callback' => 'nodequeue_service_get_nodequeues_access',
      '#file' => array('file' => 'inc', 'module' => 'nodequeue_service'),
      '#return'   => 'struct',
      '#help'     => t('Returns a keyed array by qid of available nodequeues and their settings.')
    ),
    array(
      '#method'   => 'nodequeue.getSubQueues',
      '#callback' => 'nodequeue_service_get_subqueues',
      '#access callback' => 'nodequeue_service_get_nodequeues_access',
      '#file' => array('file' => 'inc', 'module' => 'nodequeue_service'),
      '#args'             => array(
        array(
          '#name' => 'qid',
          '#type' => 'int',
          '#description' => t('A parent nodequeue queue ID.'),
        ),
      ),
      '#return'   => 'struct',
      '#help'     => t('Returns a keyed array by sqid of available subqueues and their settings.')
    ),
  );
}
