<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}
?>
<h2><?php esc_html_e( 'Api Documentation', 'kirilkirkov-pdf-invoice-manager' ); ?></h2>

<?php function kirilkirkovwipdf_get_endpoint($params) { ?>
    <div class="endpoint-container">
        <a href="javascript:;" class="show-endpoint-docs justify-between show-endpoint-docs-<?php echo esc_attr(strtolower($params['type'])) ?>">
            <div>
                <span class="request-type mr-2"><?php echo esc_html(sanitize_text_field($params['type'])); ?></span> 
                <span class="request-title"><?php echo esc_html(sanitize_text_field($params['title'])); ?></span>
            </div>

            <span class="dashicons dashicons-arrow-down-alt2"></span>
            <span class="dashicons dashicons-arrow-up-alt2 hidden"></span>
        </a>
        <div class="flex endpoint mb-4 hidden">
            <div class="w-1/2 intro pb-6">
            <div class="p-2">
                <h3 class="m-0 mb-6">
                    <?php echo esc_html(sanitize_text_field($params['title'])); ?>
                </h3>
                <p class="m-0 mb-6">
                    <?php echo esc_html(sanitize_text_field($params['description'])); ?>
                    <br>
                    <code><?php echo esc_html(sanitize_text_field($params['endpoint'])); ?></code>
                </p>
                <h4 class="uppercase m-0">
                    <?php esc_html_e( 'Query parameters', 'kirilkirkov-pdf-invoice-manager' ); ?>
                </h4>
                <table class="w-full">
                    <thead>
                        <tr>
                            <th><?php esc_html_e( 'Field', 'kirilkirkov-pdf-invoice-manager' ); ?></th>
                            <th><?php esc_html_e( 'Type', 'kirilkirkov-pdf-invoice-manager' ); ?></th>
                            <th><?php esc_html_e( 'Description', 'kirilkirkov-pdf-invoice-manager' ); ?></th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php foreach($params['query_params'] as $query_param) { ?>
                        <tr>
                            <td><?php echo esc_html(sanitize_text_field($query_param['field'])); ?></td>
                            <td><?php echo esc_html(sanitize_text_field($query_param['type'])); ?></td>
                            <td>
                                <?php if(!isset($query_param['required']) || (isset($query_param['required']) && $query_param['required'] === false)) { ?>
                                    <b><?php esc_html_e( '(not required)', 'kirilkirkov-pdf-invoice-manager' ); ?></b> 
                                <?php } ?>
                                <?php echo esc_html(sanitize_text_field($query_param['description'])); ?>
                            </td>
                        </tr>
                        <?php } ?>
                    </tbody>
                </table>
            </div>
            </div>
            <div class="w-1/2 code pb-6">
                <div class="p-2">
                    <?php if(isset($params['code']) && isset($params['code']['request'])) { ?>
                        <div class="req-resp mb-4"><?php esc_html_e( 'Request example:', 'kirilkirkov-pdf-invoice-manager' ); ?></div>
                        <pre><code><?php echo esc_html(sanitize_text_field($params['code']['request'])); ?></code></pre>
                    <?php } ?>

                    <?php if(isset($params['code']) && isset($params['code']['response'])) { ?>
                        <div class="req-resp mb-4 mt-4"><?php esc_html_e( 'Response example:', 'kirilkirkov-pdf-invoice-manager' ); ?></div>
                        <pre><code><?php echo esc_html(sanitize_text_field($params['code']['response'])); ?></code></pre>
                    <?php } ?>
            </div>
            </div>
        </div>
    </div>
<?php } ?>

<div class="api-documentation mb-4 mt-4">

    <?php
        // GET
        echo esc_html(sanitize_text_field(kirilkirkovwipdf_get_endpoint(array(
            'title' => esc_html__( 'Get Invoice/s', 'kirilkirkov-pdf-invoice-manager' ),
            'description' => esc_html__( 'To get list of invoices you need to make a GET call to the following endpoint:', 'kirilkirkov-pdf-invoice-manager' ),
            'endpoint' => '/wp-json/kirilkirkov-pdf-invoice-manager/v1/invoice/get',
            'type' => 'GET',
            'query_params' => array(
                array(
                    'field' => 'token',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => true,
                    'description' => esc_html__( 'Your API key.', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'id',
                    'type' => esc_html__( 'Integer', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Get list of all invoices or provide ID to get single invoice.', 'kirilkirkov-pdf-invoice-manager' ),
                )
            ),
            'code' => array(
                'request' => 'curl -X "GET" "https://your-website.com/wp-json/kirilkirkov-pdf-invoice-manager/v1/invoice/get?id=1&token=x"',
'response' => '
{
    "id": "1",
    "invoice_type": "invoice",
    "to_invoice_number": "",
    "from_date": "",
    "invoice_number": "0000000001",
    "invoice_date": "09.12.2022",
    "date_tax_event": "09.12.2022",
    "due_date": "24.12.2022",
    "has_maturity": "0",
    "maturity_date": "",
    "cash_accounting": "0",
    "currency": "EUR",
    "items_total": "3000.00",
    "discount": "20",
    "discount_type": "EUR",
    "vat_percent": "10",
    "vat_sum": "298.00",
    "no_vat": "0",
    "no_vat_reason": "",
    "tax_base": "2980.00",
    "final_total": "3278.00",
    "remarks": "",
    "payment_method": "Stripe",
    "paid": "0",
    "status": "0",
    "send_at": null,
    "created_from": "1",
    "compiled": "Site Developer",
    "schiffer": "",
    "created_at": "2022-12-09 20:15:19",
    "updated_at": "2022-12-09 20:15:19",
    "wc_id": "0",
    "client": {
        "id": "21",
        "client_from_list": "6",
        "client": "Adam Born",
        "is_individual": "0",
        "identification_number": "",
        "has_vat_registration": "0",
        "vat_number": "",
        "accountable_person": "Adam Born",
        "city": "New Jersey",
        "address": "9209 KENNEDY BLVD NORTH BERGEN NJ 07047-5387 USA",
        "country": "USA",
        "beneficiary": "Adam Born",
        "zip_code": "2222"
    },
    "items": {
        "item_from_list": [
            "0"
        ],
        "items_names": [
            "Web Development"
        ],
        "items_quantities": [
            "1.00"
        ],
        "items_quantity_types": [
            "Package"
        ],
        "items_prices": [
            "3000"
        ],
        "items_totals": [
            "3000.00"
        ]
    }
}
'
            )
        ))));

        echo esc_html(sanitize_text_field(kirilkirkovwipdf_get_endpoint(array(
            'title' => esc_html__( 'Get Item/s', 'kirilkirkov-pdf-invoice-manager' ),
            'description' => esc_html__( 'To get list of items you need to make a GET call to the following endpoint:', 'kirilkirkov-pdf-invoice-manager' ),
            'endpoint' => '/wp-json/kirilkirkov-pdf-invoice-manager/v1/item/get',
            'type' => 'GET',
            'query_params' => array(
                array(
                    'field' => 'token',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => true,
                    'description' => esc_html__( 'Your API key.', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'id',
                    'type' => esc_html__( 'Integer', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Get list of all items or provide ID to get single item.', 'kirilkirkov-pdf-invoice-manager' ),
                )
            ),
            'code' => array(
            'request' => 'curl -X "GET" "https://your-website.com/wp-json/kirilkirkov-pdf-invoice-manager/v1/item/get?token=x"',
'response' => '
[
    {
        "id": "1",
        "name": "Item 1",
        "price": "2.00",
        "available_quantity": "8",
        "created_from": "1",
        "created_at": "2022-03-26 15:23:14",
        "updated_at": "2022-03-26 16:49:45"
    },
    {
        "id": "2",
        "name": "Item 2",
        "price": "3.00",
        "available_quantity": "2",
        "created_from": "1",
        "created_at": "2022-03-26 15:23:14",
        "updated_at": "2022-03-26 16:49:45"
    }
]'
            )
        ))));

        echo esc_html(sanitize_text_field(kirilkirkovwipdf_get_endpoint(array(
            'title' => esc_html__( 'Get Client/s', 'kirilkirkov-pdf-invoice-manager' ),
            'description' => esc_html__( 'To get list of clients you need to make a GET call to the following endpoint:', 'kirilkirkov-pdf-invoice-manager' ),
            'endpoint' => '/wp-json/kirilkirkov-pdf-invoice-manager/v1/client/get',
            'type' => 'GET',
            'query_params' => array(
                array(
                    'field' => 'token',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => true,
                    'description' => esc_html__( 'Your API key.', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'id',
                    'type' => esc_html__( 'Integer', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Get list of all clients or provide ID to get single client.', 'kirilkirkov-pdf-invoice-manager' ),
                )
            ),
            'code' => array(
                'request' => 'curl -X "GET" "https://your-website.com/wp-json/kirilkirkov-pdf-invoice-manager/v1/client/get?token=x"',
'response' => '
[
    {
        "id": "1",
        "client": "James",
        "is_individual": "1",
        "identification_number": "82718273947",
        "has_vat_registration": "0",
        "vat_number": "",
        "accountable_person": "James B.",
        "city": "Lamashegu",
        "address": "ZU 917",
        "country": "Ghana",
        "beneficiary": "",
        "zip_code": "2222",
        "created_from": "1",
        "created_at": "2022-03-25 09:31:53",
        "updated_at": "2022-03-25 09:16:51"
    },
    {
        "id": "2",
        "client": "Adam Born",
        "is_individual": "0",
        "identification_number": "",
        "has_vat_registration": "1",
        "vat_number": "9816254918",
        "accountable_person": "2",
        "city": "New Jersey",
        "address": "9209 KENNEDY BLVD NORTH BERGEN NJ 07047-5387 USA",
        "country": "USA",
        "beneficiary": "Adam Born",
        "zip_code": "2222",
        "created_from": "1",
        "created_at": "2022-05-19 06:48:21",
        "updated_at": "2022-05-19 06:48:39"
    }
]'
            )
        ))));

        // CREATE
        echo esc_html(sanitize_text_field(kirilkirkovwipdf_get_endpoint(array(
            'title' => esc_html__( 'Create Invoice', 'kirilkirkov-pdf-invoice-manager' ),
            'description' => esc_html__( 'To create invoice you need to make a POST call to the following endpoint:', 'kirilkirkov-pdf-invoice-manager' ),
            'endpoint' => '/wp-json/kirilkirkov-pdf-invoice-manager/v1/invoice/create',
            'type' => 'POST',
            'query_params' => array(
                array(
                    'field' => 'token',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => true,
                    'description' => esc_html__( 'Your API key.', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'id',
                    'type' => esc_html__( 'Integer', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Id of invoice which wants to update or without this parameter to create new one.', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'invoice_type',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => true,
                    'description' => esc_html__( 'pro_forma | invoice | debit_note | credit_note', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'to_invoice_number',
                    'type' => esc_html__( 'Integer', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Eg. 0000000001. Used for debit_note and credit_note invoice type', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'from_date',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Eg. 01.12.2022. Used for debit_note and credit_note invoice type', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'invoice_number',
                    'type' => esc_html__( 'Integer', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => true,
                    'description' => esc_html__( 'Eg. 0000000001. Invoice number', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'invoice_date',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Eg. 01.12.2022. Invoice date', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'date_tax_event',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Eg. 01.12.2022. Date of tax event', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'due_date',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Eg. 01.12.2022. Due Date of invoice to be paid', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'has_maturity',
                    'type' => esc_html__( 'Integer', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( '0 | 1 - Has maturity date', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'maturity_date',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Eg. 01.12.2022. If has_maturity date', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'cash_accounting',
                    'type' => esc_html__( 'Integer', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( '0 | 1 - Has cash accounting', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'compiled',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Eg. Kiril Kirkov', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'schiffer',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Eg. P28177719', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'currency',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Eg. EUR', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'items_total',
                    'type' => esc_html__( 'Float', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Eg. 4.00 - Items total amount', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'discount',
                    'type' => esc_html__( 'Float', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Eg. 20 - Discount to the invoice', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'discount_type',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Eg. EUR | % - Invoice discount type', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'tax_base',
                    'type' => esc_html__( 'Float', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Eg. 16.00', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'vat_percent',
                    'type' => esc_html__( 'Float', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Eg. 10 - Percent of the vat', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'vat_sum',
                    'type' => esc_html__( 'Float', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Eg. 1.60 - Vat amount after percent', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'no_vat',
                    'type' => esc_html__( 'Integer', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( '0 | 1 - Without or with vat', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'no_vat_reason',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( '0 | 1 - Is is without vat (1), text reason', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'final_total',
                    'type' => esc_html__( 'Float', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Eg. 17.60 - Total amount of the invoice', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'remarks',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Eg. Hello.. - Remarks to the invoice', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'payment_method',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Eg. String - Payment method of the invoice', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'items[item_from_list][0..1..2..]',
                    'type' => esc_html__( 'Integer', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => true,
                    'description' => esc_html__( 'Id of the item if is from list of predefined items. 0 if is not. This will decrease quantity of item automatically', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'items[items_names][0..1..2..]',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => true,
                    'description' => esc_html__( 'Eg. Development - Name of the item', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'items[items_quantities][0..1..2..]',
                    'type' => esc_html__( 'Float', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Eg. 1.20 - Quantity of the item in the invoice', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'items[items_quantity_types][0..1..2..]',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Eg. Package|Kilograms.. - Quantity type of the item in the invoice', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'items[items_prices][0..1..2..]',
                    'type' => esc_html__( 'Float', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Single price of the item in the invoice', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'items[items_totals][0..1..2..]',
                    'type' => esc_html__( 'Float', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Final amount of the item in the invoice after Price X Quantity', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'client_from_list',
                    'type' => esc_html__( 'Integer', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => true,
                    'description' => esc_html__( 'Is client selected from predefined list of clients or not. 0 for not or ID of the client', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'client[client]',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => true,
                    'description' => esc_html__( 'Client name', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'client[is_individual]',
                    'type' => esc_html__( 'Integer', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( '0 | 1 - is company or individual person', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'client[has_vat_registration]',
                    'type' => esc_html__( 'Integer', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( '0 | 1 - is vat registered', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'client[vat_number]',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Vat number if is vat registered.', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'client[accountable_person]',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Accountable Person.', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'client[identification_number]',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'If is is_individual=1 client type', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'client[city]',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Client city', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'client[address]',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Client address', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'client[country]',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Client country', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'client[beneficiary]',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Client beneficiary', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'client[zip_code]',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Zip Code', 'kirilkirkov-pdf-invoice-manager' ),
                ),
            ),
            'code' => array(
'response' => '
{
    "success": true,
    "invoice_id": 1
}'
            )
        ))));

        echo esc_html(sanitize_text_field(kirilkirkovwipdf_get_endpoint(array(
            'title' => esc_html__( 'Create Item', 'kirilkirkov-pdf-invoice-manager' ),
            'description' => esc_html__( 'To create item you need to make a POST call to the following endpoint:', 'kirilkirkov-pdf-invoice-manager' ),
            'endpoint' => '/wp-json/kirilkirkov-pdf-invoice-manager/v1/item/create',
            'type' => 'POST',
            'query_params' => array(
                array(
                    'field' => 'token',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => true,
                    'description' => esc_html__( 'Your API key.', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'id',
                    'type' => esc_html__( 'Integer', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Pass id if wants to update item.', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'name',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => true,
                    'description' => esc_html__( 'Name of the item.', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'price',
                    'type' => esc_html__( 'Float', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Price of the item.', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'available_quantity',
                    'type' => esc_html__( 'Float', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Availabe quantity of the item.', 'kirilkirkov-pdf-invoice-manager' ),
                ),
            ),
            'code' => array(
'response' => '
{
    "success": true,
    "item_id": 1
}'
            )
        ))));

        echo esc_html(sanitize_text_field(kirilkirkovwipdf_get_endpoint(array(
            'title' => esc_html__( 'Create Client', 'kirilkirkov-pdf-invoice-manager' ),
            'description' => esc_html__( 'To create client you need to make a POST call to the following endpoint:', 'kirilkirkov-pdf-invoice-manager' ),
            'endpoint' => '/wp-json/kirilkirkov-pdf-invoice-manager/v1/client/create',
            'type' => 'POST',
            'query_params' => array(
                array(
                    'field' => 'token',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => true,
                    'description' => esc_html__( 'Your API key.', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'id',
                    'type' => esc_html__( 'Integer', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Pass id if wants to update client.', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'client',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => true,
                    'description' => esc_html__( 'Client name', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'is_individual',
                    'type' => esc_html__( 'Integer', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( '0 | 1 - is company or individual person', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'has_vat_registration',
                    'type' => esc_html__( 'Integer', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( '0 | 1 - is vat registered', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'vat_number',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Vat number if is vat registered.', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'accountable_person',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Accountable Person.', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'identification_number',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'If is is_individual=1 client type', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'city',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Client city', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'address',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Client address', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'country',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Client country', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'beneficiary',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Client beneficiary', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'zip_code',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => false,
                    'description' => esc_html__( 'Zip Code', 'kirilkirkov-pdf-invoice-manager' ),
                ),
            ),
            'code' => array(
'response' => '
{
    "success": true,
    "client_id": 1
}'
            )
        ))));

        // REMOVE
        echo esc_html(sanitize_text_field(kirilkirkovwipdf_get_endpoint(array(
            'title' => esc_html__( 'Remove Invoice', 'kirilkirkov-pdf-invoice-manager' ),
            'description' => esc_html__( 'To remove an invoice you need to make a DELETE call to the following endpoint:', 'kirilkirkov-pdf-invoice-manager' ),
            'endpoint' => '/wp-json/kirilkirkov-pdf-invoice-manager/v1/invoice/remove',
            'type' => 'DELETE',
            'query_params' => array(
                array(
                    'field' => 'token',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => true,
                    'description' => esc_html__( 'Your API key.', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'id',
                    'type' => esc_html__( 'Integer', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => true,
                    'description' => esc_html__( 'Id of the invoice which wants to remove.', 'kirilkirkov-pdf-invoice-manager' ),
                )
            ),
            'code' => array(
                'request' => 'curl -X "DELETE" "https://your-website.com/wp-json/kirilkirkov-pdf-invoice-manager/v1/invoice/remove?id=1&token=x"',
'response' => '
{
    "success": true
}'
            )
        ))));

        echo esc_html(sanitize_text_field(kirilkirkovwipdf_get_endpoint(array(
            'title' => esc_html__( 'Remove Item', 'kirilkirkov-pdf-invoice-manager' ),
            'description' => esc_html__( 'To remove an item you need to make a DELETE call to the following endpoint:', 'kirilkirkov-pdf-invoice-manager' ),
            'endpoint' => '/wp-json/kirilkirkov-pdf-invoice-manager/v1/item/remove',
            'type' => 'DELETE',
            'query_params' => array(
                array(
                    'field' => 'token',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => true,
                    'description' => esc_html__( 'Your API key.', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'id',
                    'type' => esc_html__( 'Integer', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => true,
                    'description' => esc_html__( 'Id of the item which wants to remove.', 'kirilkirkov-pdf-invoice-manager' ),
                )
            ),
            'code' => array(
                'request' => 'curl -X "DELETE" "https://your-website.com/wp-json/kirilkirkov-pdf-invoice-manager/v1/item/remove?id=1&token=x"',
'response' => '
{
    "success": true
}'
            )
        ))));

        echo esc_html(sanitize_text_field(kirilkirkovwipdf_get_endpoint(array(
            'title' => esc_html__( 'Remove Client', 'kirilkirkov-pdf-invoice-manager' ),
            'description' => esc_html__( 'To remove an client you need to make a DELETE call to the following endpoint:', 'kirilkirkov-pdf-invoice-manager' ),
            'endpoint' => '/wp-json/kirilkirkov-pdf-invoice-manager/v1/client/remove',
            'type' => 'DELETE',
            'query_params' => array(
                array(
                    'field' => 'token',
                    'type' => esc_html__( 'String', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => true,
                    'description' => esc_html__( 'Your API key.', 'kirilkirkov-pdf-invoice-manager' ),
                ),
                array(
                    'field' => 'id',
                    'type' => esc_html__( 'Integer', 'kirilkirkov-pdf-invoice-manager' ),
                    'required' => true,
                    'description' => esc_html__( 'Id of the client which wants to remove.', 'kirilkirkov-pdf-invoice-manager' ),
                )
            ),
            'code' => array(
                'request' => 'curl -X "DELETE" "https://your-website.com/wp-json/kirilkirkov-pdf-invoice-manager/v1/client/remove?id=1&token=x"',
'response' => '
{
    "success": true
}'
            )
        ))));
    ?>

</div>