<?php

namespace App\Controllers;

use App\Controllers\BaseController;
use App\Services\ServiceResponse\ServiceResponseInterface;
use CodeIgniter\HTTP\Response;
use CodeIgniter\HTTP\ResponseInterface;
use App\Services\ReciboService;

class ReciboController extends BaseController {
	
	public function getDadosExtornoByIdToRecibo(int $extorno_id): Response {
		
		$recibo_service = new ReciboService();
		$recibo_service_response = $recibo_service->getDadosExtornoByIdToRecibo($extorno_id);
		
		$response_messages = [
				ServiceResponseInterface::SUCESS => [
						'code' => ResponseInterface::HTTP_OK,
						'message' => 'Os dados para emissão do recibo foram encontrados com sucesso.'
				],
				ServiceResponseInterface::RECORD_NOT_FOUND => [
						'code' => ResponseInterface::HTTP_PARTIAL_CONTENT,
						'message' => 'Nenhum registro foi encontrado.'
				],
				ServiceResponseInterface::SERVICE_INTERNAL_ERROR => [
						'code' => ResponseInterface::HTTP_INTERNAL_SERVER_ERROR,
						'message' => 'Erro interno do servidor.'
				],
				ServiceResponseInterface::DATABASE_CONNECTION_ERROR => [
						'code' => ResponseInterface::HTTP_INTERNAL_SERVER_ERROR,
						'message' => 'Erro interno do servidor.'
				]
		];
		return $this->getResponse( $recibo_service_response, $response_messages );
		
	}

}

