<?php

use app\models\Proto;
use Codeception\Util\HttpCode;

class V1Cest {
    private string $demoServiceAuth = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';

    public function _before(ApiTester $I) {

    }

    // tests
    // public function performTest(ApiTester $I) {
    //     $I->sendGet('v1/api/test');
    //     $I->seeResponseCodeIs(HttpCode::OK); // 200
    //     $I->seeResponseIsJson();
    //     $I->seeResponseMatchesJsonType([
    //         'success' => 'boolean',
    //         'message' => 'string'
    //     ]);
    // }


    public function testProtobufToJson(ApiTester $I) {
        $I->haveHttpHeader('Content-Type', Proto::CONTENT_TYPE);
        $I->haveHttpHeader('Service-Authorization', $this->demoServiceAuth);
        $I->sendPost('v1/api/to-json', '{r#2!
            
            The message has been sent');
        $I->seeResponseCodeIs(HttpCode::OK);
    }
}
