<?php

namespace Convertforce\Admin\Api;

use WP_REST_Response;

class Api
{

    public const NAMESPACE = 'convertforce';

    public static function register()
    {

    }


    public static function ok($message = "Operation completed successfully.", $data = [], $status_code = 200)
    {
        return new WP_REST_Response([
            'success' => true,
            'message' => $message,
            'data' => $data
        ], $status_code, [
            'Cache-Control' => 'no-cache',
            'Expires' => '0',
            'Pragma' => 'no-cache',
        ]);
    }



    public static function paged($data, $pagination, $message = "Data retrieved successfully.", $status_code = 200)
    {
        return new WP_REST_Response([
            'success' => true,
            'message' => $message,
            'data' => $data,
            'pagination' => $pagination
        ], $status_code, [
            'Cache-Control' => 'no-cache',
            'Expires' => '0',
            'Pragma' => 'no-cache',
        ]);
    }


    public static function fail($message = "An error occurred.", $errors = [], $status_code = 400)
    {
        return new WP_REST_Response([
            'success' => false,
            'message' => $message,
            'errors' => $errors
        ], $status_code, [
            'Cache-Control' => 'no-cache',
            'Expires' => '0',
            'Pragma' => 'no-cache',
        ]);
    }

}
