<?php defined('ALTUMCODE') || die() ?>

<div class="container">
    <?php if(settings()->main->breadcrumbs_is_enabled): ?>
        <nav aria-label="breadcrumb">
            <ol class="custom-breadcrumbs small">
                <li><a href="<?= url() ?>"><?= l('index.breadcrumb') ?></a> <i class="fas fa-fw fa-angle-right"></i></li>
                <li><a href="<?= url('api-documentation') ?>"><?= l('api_documentation.breadcrumb') ?></a> <i class="fas fa-fw fa-angle-right"></i></li>
                <li class="active" aria-current="page"><?= l('stores.title') ?></li>
            </ol>
        </nav>
    <?php endif ?>

    <h1 class="h4 mb-4"><?= l('stores.title') ?></h1>

    <div class="accordion">
        <div class="card">
            <div class="card-header bg-white p-3 position-relative">
                <h3 class="h6 m-0">
                    <a href="#" class="stretched-link text-decoration-none" data-toggle="collapse" data-target="#stores_read_all" aria-expanded="true" aria-controls="stores_read_all">
                        <span class="badge badge-success user-select-none mr-3"><i class="fas fa-fw fa-sm fa-list"></i></span> <?= l('api_documentation.read_all') ?>
                    </a>
                </h3>
            </div>

            <div id="stores_read_all" class="collapse">
                <div class="card-body">

                    <div class="form-group mb-4">
                        <label><?= l('api_documentation.endpoint') ?></label>
                        <div class="card bg-gray-100 border-0">
                            <div class="card-body">
                                <span class="badge badge-success user-select-none mr-3">GET</span> <span class="text-muted"><?= SITE_URL ?>api/stores/</span>
                            </div>
                        </div>
                    </div>

                    <div class="form-group mb-4">
                        <label><?= l('api_documentation.example') ?></label>
                        <div class="card bg-gray-100 border-0">
                            <div class="card-body">
                                curl --request GET \<br />
                                --url '<?= SITE_URL ?>api/stores/' \<br />
                                --header 'Authorization: Bearer <span class="text-primary" <?= is_logged_in() ? 'data-toggle="tooltip" title="' . l('api_documentation.api_key') . '"' : null ?>><?= is_logged_in() ? $this->user->api_key : '{api_key}' ?></span>' \
                            </div>
                        </div>
                    </div>

                    <div class="table-responsive table-custom-container mb-4">
                        <table class="table table-custom">
                            <thead>
                            <tr>
                                <th><?= l('api_documentation.parameters') ?></th>
                                <th><?= l('global.details') ?></th>
                                <th><?= l('global.description') ?></th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr>
                                <td>search</td>
                                <td>
                                    <span class="badge badge-info"><i class="fas fa-fw fa-sm fa-circle-notch mr-1"></i> <?= l('api_documentation.optional') ?></span>
                                    <span class="badge badge-secondary"><i class="fas fa-fw fa-sm fa-font mr-1"></i> <?= l('api_documentation.string') ?></span>
                                </td>
                                <td><?= l('api_documentation.filters.search') ?></td>
                            </tr>

                            <tr>
                                <td>search_by</td>
                                <td>
                                    <span class="badge badge-info"><i class="fas fa-fw fa-sm fa-circle-notch mr-1"></i> <?= l('api_documentation.optional') ?></span>
                                    <span class="badge badge-secondary"><i class="fas fa-fw fa-sm fa-font mr-1"></i> <?= l('api_documentation.string') ?></span>
                                </td>
                                <td><?= sprintf(l('api_documentation.filters.search_by'), '<code>' . implode('</code>, <code>', ['name', 'url']) . '</code>') ?></td>
                            </tr>

                            <tr>
                                <td>is_enabled</td>
                                <td>
                                    <span class="badge badge-info"><i class="fas fa-fw fa-sm fa-circle-notch mr-1"></i> <?= l('api_documentation.optional') ?></span>
                                    <span class="badge badge-secondary"><i class="fas fa-fw fa-sm fa-toggle-on mr-1"></i> <?= l('api_documentation.boolean') ?></span>
                                </td>
                                <td></td>
                            </tr>

                            <?php if(settings()->stores->domains_is_enabled): ?>
                                <tr>
                                    <td>domain_id</td>
                                    <td>
                                        <span class="badge badge-info"><i class="fas fa-fw fa-sm fa-circle-notch mr-1"></i> <?= l('api_documentation.optional') ?></span>
                                        <span class="badge badge-secondary"><i class="fas fa-fw fa-sm fa-hashtag mr-1"></i> <?= l('api_documentation.int') ?></span>
                                    </td>
                                    <td></td>
                                </tr>
                            <?php endif ?>

                            <tr>
                                <td>order_by</td>
                                <td>
                                    <span class="badge badge-info"><i class="fas fa-fw fa-sm fa-circle-notch mr-1"></i> <?= l('api_documentation.optional') ?></span>
                                    <span class="badge badge-secondary"><i class="fas fa-fw fa-sm fa-font mr-1"></i> <?= l('api_documentation.string') ?></span>
                                </td>
                                <td><?= sprintf(l('api_documentation.filters.order_by'), '<code>' . implode('</code>, <code>', ['store_id', 'last_datetime', 'datetime', 'pageviews', 'name', 'url', 'orders']) . '</code>') ?></td>
                            </tr>

                            <tr>
                                <td>order_type</td>
                                <td>
                                    <span class="badge badge-info"><i class="fas fa-fw fa-sm fa-circle-notch mr-1"></i> <?= l('api_documentation.optional') ?></span>
                                    <span class="badge badge-secondary"><i class="fas fa-fw fa-sm fa-font mr-1"></i> <?= l('api_documentation.string') ?></span>
                                </td>
                                <td><?= l('api_documentation.filters.order_by_type') ?></td>
                            </tr>

                            <tr>
                                <td>page</td>
                                <td>
                                    <span class="badge badge-info"><i class="fas fa-fw fa-sm fa-circle-notch mr-1"></i> <?= l('api_documentation.optional') ?></span>
                                    <span class="badge badge-secondary"><i class="fas fa-fw fa-sm fa-hashtag mr-1"></i> <?= l('api_documentation.int') ?></span>
                                </td>
                                <td><?= l('api_documentation.filters.page') ?></td>
                            </tr>
                            <tr>
                                <td>results_per_page</td>
                                <td>
                                    <span class="badge badge-info"><i class="fas fa-fw fa-sm fa-circle-notch mr-1"></i> <?= l('api_documentation.optional') ?></span>
                                    <span class="badge badge-secondary"><i class="fas fa-fw fa-sm fa-hashtag mr-1"></i> <?= l('api_documentation.int') ?></span>
                                </td>
                                <td><?= sprintf(l('api_documentation.filters.results_per_page'), '<code>' . implode('</code> , <code>', [10, 25, 50, 100, 250, 500, 1000]) . '</code>', 25) ?></td>
                            </tr>
                            </tbody>
                        </table>
                    </div>

                    <div class="form-group">
                        <label><?= l('api_documentation.response') ?></label>
                        <pre data-shiki="json">
{
    "data": [
        {
            "store_id": 1,
            "domain_id": null,
            "user_id": 1,
            "url": "example",
            "full_url": "<?= SITE_URL ?>example",
            "name": "Vintage Machine",
            "description": "great coffee, food & relaxing spot.",
            "settings": {
                "title": "Example title",
                "meta_description": "Example description",
                "meta_keywords": "keyword1,keyword2",
                "language_code": "en",
                "font_family": "default",
                "font_size": 16,
                "display_share_buttons": 1,
                "auto_refresh": 10,
            },
            "details": {
                "address": "Lorem ipsum dolor sit amet, number 200, street consectetur adipiscing.",
                "phone": "+100100100",
                "website": "https://example.com",
                "email": "example@example.com",
                "hours": {
                    "1": {
                        "is_enabled": true,
                        "hours": "10AM - 9PM"
                    },
                    "2": {
                        "is_enabled": true,
                        "hours": "10AM - 9PM"
                    },
                    "3": {
                        "is_enabled": true,
                        "hours": "10AM - 9PM"
                    },
                    "4": {
                        "is_enabled": true,
                        "hours": "10AM - 9PM"
                    },
                    "5": {
                        "is_enabled": true,
                        "hours": "10AM - 9PM"
                    },
                    "6": {
                        "is_enabled": true,
                        "hours": "24/7"
                    },
                    "7": {
                        "is_enabled": true,
                        "hours": "24/7"
                    }
                }
            },
            "socials": {
                "facebook": "example",
                "instagram": "example",
                "x": "example"
            },
            "currency": "USD",
            "password": null,
            "image": "example.jpg",
            "logo": "example.png",
            "favicon": "example.png",
            "opengraph": "",
            "theme": "new-york",
            "timezone": "UTC",
            "custom_css": "",
            "custom_js": "",
            "pageviews": 50,
            "orders": 100,
            "is_se_visible": true,
            "is_removed_branding": true,
            "email_reports_is_enabled": true,
            "email_reports_last_datetime": null,
            "email_orders_is_enabled": false,
            "ordering": {
                "on_premise_is_enabled": 1,
                "delivery_is_enabled": 1,
                "takeaway_is_enabled": 1,
                "on_premise_minimum_value": 0,
                "delivery_minimum_value": 5,
                "delivery_cost": 5,
                "delivery_free_minimum_value": 10,
                "takeaway_minimum_value": 0
            },
            "payment_processors": {
                "paypal_is_enabled": false,
                "paypal_mode": "live",
                "paypal_client_id": "",
                "paypal_secret": "",
                "stripe_is_enabled": true,
                "stripe_publishable_key": "",
                "stripe_secret_key": "",
                "stripe_webhook_secret": "",
                "mollie_is_enabled": true,
                "mollie_api_key": "",
                "paystack_is_enabled": true,
                "paystack_api_key": "",
                "paystack_secret_key": "",
                "offline_payment_is_enabled": true
            },
            "business": {
                "invoice_is_enabled": true,
                "invoice_nr_prefix": "VINTAGE-",
                "name": "Vintage Machine",
                "address": "Vintage Machine Street One",
                "city": "Vintage City",
                "county": "",
                "zip": "123123",
                "country": "US",
                "email": "",
                "phone": "+101010101010",
                "tax_type": "",
                "tax_id": "",
                "custom_key_one": "",
                "custom_value_one": "",
                "custom_key_two": "",
                "custom_value_two": ""
            },
            "is_enabled": true,
            "datetime": "<?= get_date() ?>",
            "last_datetime": null
        }
    ],
    "meta": {
        "page": 1,
        "results_per_page": 25,
        "total": 1,
        "total_pages": 1
    },
    "links": {
        "first": "<?= SITE_URL ?>api/stores?page=1",
        "last": "<?= SITE_URL ?>api/stores?page=1",
        "next": null,
        "prev": null,
        "self": "<?= SITE_URL ?>api/stores?page=1"
    }
}
</pre>
                    </div>
                </div>
            </div>
        </div>


        <div class="card">
            <div class="card-header bg-white p-3 position-relative">
                <h3 class="h6 m-0">
                    <a href="#" class="stretched-link text-decoration-none" data-toggle="collapse" data-target="#stores_read" aria-expanded="true" aria-controls="stores_read">
                        <span class="badge badge-success user-select-none mr-3"><i class="fas fa-fw fa-sm fa-eye"></i></span> <?= l('api_documentation.read') ?>
                    </a>
                </h3>
            </div>

            <div id="stores_read" class="collapse">
                <div class="card-body">

                    <div class="form-group mb-4">
                        <label><?= l('api_documentation.endpoint') ?></label>
                        <div class="card bg-gray-100 border-0">
                            <div class="card-body">
                                <span class="badge badge-success user-select-none mr-3">GET</span> <span class="text-muted"><?= SITE_URL ?>api/stores/</span><span class="text-primary">{store_id}</span>
                            </div>
                        </div>
                    </div>

                    <div class="form-group mb-4">
                        <label><?= l('api_documentation.example') ?></label>
                        <div class="card bg-gray-100 border-0">
                            <div class="card-body">
                                curl --request GET \<br />
                                --url '<?= SITE_URL ?>api/stores/<span class="text-primary">{store_id}</span>' \<br />
                                --header 'Authorization: Bearer <span class="text-primary" <?= is_logged_in() ? 'data-toggle="tooltip" title="' . l('api_documentation.api_key') . '"' : null ?>><?= is_logged_in() ? $this->user->api_key : '{api_key}' ?></span>' \
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label><?= l('api_documentation.response') ?></label>
                        <pre data-shiki="json">
{
    "data": {
        "store_id": 1,
        "domain_id": null,
        "user_id": 1,
        "url": "example",
        "full_url": "<?= SITE_URL ?>example",
        "name": "Vintage Machine",
        "description": "great coffee, food & relaxing spot.",
        "settings": {
            "title": "Example title",
            "meta_description": "Example description",
            "meta_keywords": "keyword1,keyword2",
            "language_code": "en",
            "font_family": "default",
            "font_size": 16,
            "display_share_buttons": 1,
            "auto_refresh": 10,
        },
        "details": {
            "address": "Lorem ipsum dolor sit amet, number 200, street consectetur adipiscing.",
            "phone": "+100100100",
            "website": "https://example.com",
            "email": "example@example.com",
            "hours": {
                "1": {
                    "is_enabled": true,
                    "hours": "10AM - 9PM"
                },
                "2": {
                    "is_enabled": true,
                    "hours": "10AM - 9PM"
                },
                "3": {
                    "is_enabled": true,
                    "hours": "10AM - 9PM"
                },
                "4": {
                    "is_enabled": true,
                    "hours": "10AM - 9PM"
                },
                "5": {
                    "is_enabled": true,
                    "hours": "10AM - 9PM"
                },
                "6": {
                    "is_enabled": true,
                    "hours": "24/7"
                },
                "7": {
                    "is_enabled": true,
                    "hours": "24/7"
                }
            }
        },
        "socials": {
            "facebook": "example",
            "instagram": "example",
            "x": "example"
        },
        "currency": "USD",
        "password": null,
        "image": "example.jpg",
        "logo": "example.png",
        "favicon": "example.png",
        "opengraph": "",
        "theme": "new-york",
        "timezone": "UTC",
        "custom_css": "",
        "custom_js": "",
        "pageviews": 50,
        "orders": 100,
        "is_se_visible": true,
        "is_removed_branding": true,
        "email_reports_is_enabled": true,
        "email_reports_last_datetime": null,
        "email_orders_is_enabled": false,
        "ordering": {
            "on_premise_is_enabled": 1,
            "delivery_is_enabled": 1,
            "takeaway_is_enabled": 1,
            "on_premise_minimum_value": 0,
            "delivery_minimum_value": 5,
            "delivery_cost": 5,
            "delivery_free_minimum_value": 10,
            "takeaway_minimum_value": 0
        },
        "payment_processors": {
            "paypal_is_enabled": false,
            "paypal_mode": "live",
            "paypal_client_id": "",
            "paypal_secret": "",
            "stripe_is_enabled": true,
            "stripe_publishable_key": "",
            "stripe_secret_key": "",
            "stripe_webhook_secret": "",
            "mollie_is_enabled": true,
            "mollie_api_key": "",
            "paystack_is_enabled": true,
            "paystack_api_key": "",
            "paystack_secret_key": "",
            "offline_payment_is_enabled": true
        },
        "business": {
            "invoice_is_enabled": true,
            "invoice_nr_prefix": "VINTAGE-",
            "name": "Vintage Machine",
            "address": "Vintage Machine Street One",
            "city": "Vintage City",
            "county": "",
            "zip": "123123",
            "country": "US",
            "email": "",
            "phone": "+101010101010",
            "tax_type": "",
            "tax_id": "",
            "custom_key_one": "",
            "custom_value_one": "",
            "custom_key_two": "",
            "custom_value_two": ""
        },
        "is_enabled": true,
        "datetime": "<?= get_date() ?>",
        "last_datetime": null
    }
}
</pre>
                    </div>
                </div>
            </div>
        </div>

    </div>
</div>

<?php require THEME_PATH . 'views/partials/shiki_highlighter.php' ?>
