<?php

require("../../../../vendor/autoload.php");

use OpenApi\Annotations as OA;


/**
 * @OA\Info(
 *      title="OxaMobility", 
 *      version="10.51ab", 
 *      description="Documentation API Mobilité OxaProc", 
 *      @OA\Contact(
 *        email="support@oxalys.com"
 *      )
 * ),
 * 
 * @OA\Server(
 *      url="https://test115.oxacloud.oxalys.fr/oxaproc115/V2/API/oxa",
 *      description="Serveur de développement",
 * ),
 * 
 * @OA\SecurityScheme(
 *      securityScheme="ApiKeyAuth",
 *      type="apiKey",
 *      in="header",
 *      name="X_OXA_TOKEN",
 * ),
 * 
 * @OA\Security(
 *   apiKeyauth=[], 
 * ),
 * 
 * @OA\Components(
 *   @OA\Schema(
 *     schema="Param", 
 *     type="array",
 *     @OA\Items(
 *       @OA\Property(
 *         property="DateLivraisonObligatoire",
 *         type="boolean",
 *         example="true",
 *       ),
 *       @OA\Property(
 *         property="NumLivraisonObligatoire",
 *         type="boolean",
 *         example="true",
 *       ),
 *       @OA\Property(
 *         property="ExcedentLivraisonControlBloquant",
 *         type="boolean",
 *         example="true",
 *       ),
 *       @OA\Property(
 *         property="ExcedentLivraisonControlMontant",
 *         type="integer",
 *         example="0.00",
 *       ),
 *       @OA\Property(
 *         property="ExcedentLivraisonControlTaux",
 *         type="integer",
 *         example="0",
 *       ),
 *       @OA\Property(
 *         property="SabranesOaxley",
 *         type="boolean",
 *         example="false",
 *       )
 *     )
 *   ), 
 *   
 *   @OA\Schema(
 *     schema="Entete", 
 *     type="array",
 *     @OA\Items(
 *       @OA\Property(
 *         property="NumCde",
 *         type="integer",
 *         example="26",
 *       ),
 *       @OA\Property(
 *         property="DEVISE",
 *         type="string",
 *         example="EUR",
 *       ),
 *       @OA\Property(
 *         property="HT_TTC",
 *         type="string",
 *         example="HT",
 *       ),
 *       @OA\Property(
 *         property="ListeTypeInc",
 *         type="object",
 *         @OA\Property(
 *           property="TypeInc",
 *           type="array",
 *           @OA\Items(
 *             @OA\Property(property="COD_INC", type="string", example="MANQ"), 
 *             @OA\Property(property="LIBELLE", type="string", example="Quantité Manquante")
 *           )
 *         )
 *       )
 *     ),
 *   ), 
 *   
 *   @OA\Schema(
 *     schema="Lignes", 
 *     type="array",
 *     @OA\Items(
 *       @OA\Property(
 *         property="DateLivraisonObligatoire",
 *         type="boolean",
 *         example="true",
 *       ),
 *       @OA\Property(
 *         property="NumLivraisonObligatoire",
 *         type="boolean",
 *         example="true",
 *       ),
 *       @OA\Property(
 *         property="ExcedentLivraisonControlBloquant",
 *         type="boolean",
 *         example="true",
 *       ),
 *       @OA\Property(
 *         property="ExcedentLivraisonControlMontant",
 *         type="integer",
 *         example="0.00",
 *       ),
 *       @OA\Property(
 *         property="ExcedentLivraisonControlTaux",
 *         type="integer",
 *         example="0",
 *       ),
 *       @OA\Property(
 *         property="SabranesOaxley",
 *         type="boolean",
 *         example="false",
 *       )
 *     )
 *   ), 
 *   
 *   @OA\Schema(
 *     schema="MPROC_In", 
 *     type="array",
 *     @OA\Items(
 *       @OA\Property(
 *         property="MprocVers",
 *         type="integer",
 *         example="1.2.0",
 *       ),
 *       @OA\Property(
 *         property="LngUtilisation",
 *         type="string",
 *         example="FR",
 *       ),
 *       @OA\Property(
 *         property="token",
 *         type="string",
 *         example="eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9",
 *       ),
 *       @OA\Property(
 *         property="Action",
 *         type="string",
 *         example="BR|ECRAN_CREATION",
 *       ),
 *       @OA\Property(
 *         property="Utilisateur",
 *         type="string",
 *         example="RA",
 *       ),
 *       @OA\Property(
 *         property="NumCde",
 *         type="integer",
 *         example="26",
 *       )
 *     )
 *   ), 
 *   
 *  )
 *  
 *  
 * 
 * 
 */

$openapi = \OpenApi\scan('../../../../src');
// Fichier::createFichierTmp('toto.txt',$openapi);exit;
// print_r($openapi);exit;
header('Content-Type: application/x-json');
$return = json_decode($openapi->toJson(), true);
$return['components']['requestBodies']['MprocIn']['description'] = 'Expected elements for receipt creation';
$return['components']['requestBodies']['MprocIn']['required'] = true;
$return['components']['requestBodies']['MprocIn']['content']['application/json']['schema']['$ref'] = '#/components/schemas/elementsBr';
$return['components']['schemas']['Param']['type'] = 'Pet object that needs to be added to the store';
$return['components']['schemas']['Param']['required'] = true;
$return['components']['schemas']['Entete']['application/xml']['schema']['$ref'] = '#/components/schemas/Lignes';
$return['components']['schemas']['Entete']['description'] = 'Pet object that needs to be added to the store';
$return['components']['schemas']['Lignes']['required'] = true;
$return['components']['schemas']['Lignes']['application/json']['schema']['$ref'] = '#/components/schemas/Lignes';
$return['components']['schemas']['elementsBr']['type'] = 'array';
$return['components']['schemas']['elementsBr']['items']['properties']['MprocVers']['type'] = 'integer';
$return['components']['schemas']['elementsBr']['items']['properties']['MprocVers']['example'] = '1.2.0';
$return['components']['schemas']['elementsBr']['items']['properties']['LngUtilisation']['type'] = 'string';
$return['components']['schemas']['elementsBr']['items']['properties']['LngUtilisation']['example'] = 'FR';
$return['components']['schemas']['elementsBr']['items']['properties']['token']['type'] = 'string';
$return['components']['schemas']['elementsBr']['items']['properties']['token']['example'] = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9';
$return['components']['schemas']['elementsBr']['items']['properties']['Action']['type'] = 'string';
$return['components']['schemas']['elementsBr']['items']['properties']['Action']['example'] = 'BR|ECRAN_CREATION';
$return['components']['schemas']['elementsBr']['items']['properties']['Utilisateur']['type'] = 'string';
$return['components']['schemas']['elementsBr']['items']['properties']['Utilisateur']['example'] = 'RA';
$return['components']['schemas']['elementsBr']['items']['properties']['NumCde']['type'] = 'integer';
$return['components']['schemas']['elementsBr']['items']['properties']['NumCde']['example'] = '26';
$return['components']['schemas']['mprocOut']['type'] = 'array';
$return['components']['schemas']['mprocOut']['items']['properties']['Statut']['type'] = 'string';
$return['components']['schemas']['mprocOut']['items']['properties']['Statut']['example'] = 'O';
$return['components']['schemas']['mprocOut']['items']['properties']['NumCde']['type'] = 'integer';
$return['components']['schemas']['mprocOut']['items']['properties']['NumCde']['example'] = '26';
$return['components']['schemas']['mprocOut']['items']['properties']['DEVISE']['type'] = 'string';
$return['components']['schemas']['mprocOut']['items']['properties']['DEVISE']['example'] = 'EUR';
$return['components']['schemas']['mprocOut']['items']['properties']['HT_TTC']['type'] = 'string';
$return['components']['schemas']['mprocOut']['items']['properties']['HT_TTC']['example'] = 'HT';
$return['components']['schemas']['mprocOut']['items']['properties']['Date de livraison']['type'] = 'date-time';
$return['components']['schemas']['mprocOut']['items']['properties']['Date de livraison']['example'] = '26/09/2022';
json_encode($return);
header('Content-disposition: attachment; filename=oxa-api-swagger.json');
header('Content-type: application/json');
echo json_encode($return);
@exit; 
