<?php

/**
 * \file VitisSections.class.inc
 * \class VitisSections
 *
 * \author Yoann Perollet <yoann.perollet@veremes.com>.
 *
 * 	\brief This file contains the VitisSections php class
 *
 * This class defines Rest Api to Vitis sections
 * 
 */
require_once 'Vitis.class.inc';
require_once __DIR__ . '/../../class/vitis_lib/Connection.class.inc';
require_once 'VitisSection.class.inc';
require_once(__DIR__ . '/../../class/vmlib/BdDataAccess.inc');

class VitisSections extends Vitis {
    /**
     * @SWG\Definition(
     *   definition="/VitisSections",
     *   allOf={
     *     @SWG\Schema(ref="#/definitions/VitisSections")
     *   }
     * )
     * * @SWG\Tag(
     *   name="VitisSections",
     *   description="Operations about VitisSections"
     * )
     * @SWG\Response(
     *         response=200,
     *         description="Poprerties Response",
     *         @SWG\Schema(ref="#/definitions/VitisSections")
     *     )
     */

    /**
     * construct
     * @param type $aPath url of the request
     * @param type $aValues parameters of the request
     * @param type $properties properties
     * @param type $bShortcut false to reinit variables
     * @param type $oConnection connection object
     */
    function __construct($aPath, $aValues, $properties, $bShortcut = false, $oConnection = false) {
        parent::__construct($aPath, $aValues, $properties, $bShortcut, $oConnection);
        $this->aSelectedFields = Array("section_id", "tab_id", "event", "index", "label", "name", "link_table_name", "template", "ressource_id", "tab_name", "mode_id", "module_name");
    }

    /**
     * @SWG\Get(path="/vitissections",
     *   tags={"VitisSections"},
     *   summary="Get VitisSections",
     *   description="Request to get VitisSections",
     *   operationId="GET",
     *   produces={"application/xml", "application/json", "application/x-vm-json"},
     *   @SWG\Parameter(
     *     name="token",
     *     in="query",
     *     description="user token",
     *     required=true,
     *     type="string"
     *   ),
     * @SWG\Parameter(
     *     name="order_by",
     *     in="query",
     *     description="list of ordering fields",
     *     required=false,
     *     type="string"
     *   ),
     * @SWG\Parameter(
     *     name="sort_order",
     *     in="query",
     *     description="sort order",
     *     required=false,
     *     type="string"
     *   ),
     * @SWG\Parameter(
     *     name="limit",
     *     in="query",
     *     description="number of element",
     *     required=false,
     *     type="integer",
     *     format="int32"
     *   ),
     * @SWG\Parameter(
     *     name="offset",
     *     in="query",
     *     description="index of first element",
     *     required=false,
     *     type="string",
     *     format="int32"
     *   ),
     * @SWG\Parameter(
     *     name="attributs",
     *     in="query",
     *     description="list of attributs",
     *     required=false,
     *     type="string"
     *   ),
     * @SWG\Parameter(
     *     name="filter",
     *     in="query",
     *     description="filter results",
     *     required=false,
     *     type="string"
     *   ),
     * @SWG\Parameter(
     *     name="distinct",
     *     in="query",
     *     description="delete duplicates",
     *     required=false,
     *     type="boolean"
     *   ),
     * @SWG\Response(
     *         response=200,
     *         description="Poprerties Response",
     *         @SWG\Schema(ref="#/definitions/VitisSections")
     *     )
     *  )
     */

    /**
     * get VitisSections
     * @return VitisSections
     */
    function GET() {
        $aReturn = $this->genericGet($this->aProperties['schema_framework'], "v_section", "section_id");
        return $aReturn['sMessage'];
    }

}

?>