@extends('[% layout_name %]')

@section('content')

<h2>[% model_plural %]</h2>
[% general_description %]
<hr>

<h2>[% available_resources %]</h2>
<div class="card mb-3" id="index-documentation">

    <div class="card-header text-bg-primary d-flex justify-content-between align-items-center p-3">
        <div>
            <span class="">GET</span>
            <span><strong>/{{ Route::getRoutes()->getByName('[% index_route_name %]')->uri() }}</strong></span>
            <p class="mb-0">[% index_route_description %]</p>
        </div>
        <div>
            <button type="button" data-bs-toggle="collapse" data-bs-target="#index" aria-controls="index" class="btn btn-primary btn-sm" aria-expanded="false">
                <span class="fa-solid fa-chevron-down"></span>
            </button>
        </div>
    </div>

    <div class="card-body collapse" id="index">
        <h3><strong>[% request_title %]</strong></h3>
        [% authorized_request_for_index %]

        <hr>
        <h3><strong>[% response_title %]</strong></h3>

        <p>[% index_route_response_description %]</p>
        <p></p>

        <h4><strong class="text-success">200 - Ok</strong></h4>
        <p class="text-muted">[% request_was_successful %]</p>
        <table class="table table-stripped">
            <tbody>
                <tr>
                    <td>success</td>
                    <td>[% boolean_title %]</td>
                    <td>Was the request successful or not.</td>
                </tr>
                <tr>
                    <td>message</td>
                    <td>[% string_title %]</td>
                    <td>[% the_success_message %]</td>
                </tr>

                <tr>
                    <td>data</td>
                    <td>[% array_title %]</td>
                    <td>
                        [% the_key_is_the_model_property_and_the_value_is_the_model_value %]
                    </td>
                </tr>

                <tr>
                    <td>links</td>
                    <td>[% array_title %]</td>
                    <td>
                        <table class="table table-stripped">
                            <thead>
                                <tr>
                                    <th class="col-md-2">[% key_title %]</th>
                                    <th class="col-md-2">[% data_type_title %]</th>
                                    <th class="col-md-8">[% description_title %]</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td>first</td>
                                    <td>[% string_title %]</td>
                                    <td>[% link_to_retrieve_first_page %]</td>
                                </tr>

                                <tr>
                                    <td>last</td>
                                    <td>[% string_title %]</td>
                                    <td>[% link_to_retrieve_last_page %]</td>
                                </tr>

                                <tr>
                                    <td>prev</td>
                                    <td>[% string_title %]</td>
                                    <td>[% link_to_retrieve_previous_page %]</td>
                                </tr>

                                <tr>
                                    <td>next</td>
                                    <td>[% string_title %]</td>
                                    <td>[% link_to_retrieve_next_page %]</td>
                                </tr>
                            </tbody>
                        </table>

                    </td>
                </tr>


                <tr>
                    <td>meta</td>
                    <td>[% array_title %]</td>
                    <td>
                        <table class="table table-stripped">
                            <thead>
                                <tr>
                                    <th class="col-md-2">[% key_title %]</th>
                                    <th class="col-md-2">[% data_type_title %]</th>
                                    <th class="col-md-8">[% description_title %]</th>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td>current_page</td>
                                    <td>[% integer_title %]</td>
                                    <td>[% the_number_of_current_page %]</td>
                                </tr>

                                <tr>
                                    <td>from</td>
                                    <td>[% integer_title %]</td>
                                    <td>[% the_index_of_the_first_retrieved_item %]</td>
                                </tr>

                                <tr>
                                    <td>last_page</td>
                                    <td>[% integer_title %]</td>
                                    <td>[% the_number_of_the_last_page %]</td>
                                </tr>

                                <tr>
                                    <td>Path</td>
                                    <td>[% string_title %]</td>
                                    <td>[% the_base_link_to_the_resource %]</td>
                                </tr>

                                <tr>
                                    <td>per_page</td>
                                    <td>[% integer_title %]</td>
                                    <td>[% the_number_of_models_per_page %]</td>
                                </tr>

                                <tr>
                                    <td>to</td>
                                    <td>[% integer_title %]</td>
                                    <td>[% the_index_of_the_last_retrieved_item %]</td>
                                </tr>

                                <tr>
                                    <td>total</td>
                                    <td>[% integer_title %]</td>
                                    <td>[% the_total_of_available_pages %]</td>
                                </tr>
                            </tbody>
                        </table>

                    </td>
                </tr>

            </tbody>
        </table>

        [% include_failed_authentication_for_authorized_request %]

    </div>
</div>


<div class="card mb-3" id="store-documentation">

    <div class="card-header text-bg-success d-flex justify-content-between align-items-center p-3">
        <div>
            <span>POST</span>
             <span><strong>/{{ Route::getRoutes()->getByName('[% store_route_name %]')->uri() }}</strong></span>
            <p class="mb-0">[% store_route_description %]</p>
        </div>
        <div>
            <button type="button" data-bs-toggle="collapse" data-bs-target="#store" aria-controls="store" class="btn btn-success btn-sm" aria-expanded="false">
                <span class="fa-solid fa-chevron-down"></span>
            </button>
        </div>
    </div>

    <div class="card-body collapse" id="store">
        <h3><strong>[% request_title %]</strong></h3>
        
        @include('[% path_to_view_home %]fields-list', [
            'withValidation' => true
        ])

        <hr>
        <h3><strong>[% response_title %]</strong></h3>
        <p>[% store_route_response_description %]</p>
        <p></p>

        @include('[% path_to_view_home %]retrieved')
        @include('[% path_to_view_home %]failed-to-retrieve')
        @include('[% path_to_view_home %]failed-validation')
        [% include_failed_authentication_for_authorized_request %]

    </div>
</div>



<div class="card mb-3" id="update-documentation">

    <div class="card-header text-bg-warning d-flex justify-content-between align-items-center p-3">
        <div>
            <span class="">POST</span>
            <span><strong>/{{ Route::getRoutes()->getByName('[% update_route_name %]')->uri() }}</strong></span>
            <p class="mb-0">[% update_route_description %]</p>
        </div>
        <div>
            <button type="button" data-bs-toggle="collapse" data-bs-target="#update" aria-controls="update" class="btn btn-warning btn-sm" aria-expanded="false">
                <span class="fa-solid fa-chevron-down"></span>
            </button>
        </div>
    </div>

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

            <h3><strong>[% request_title %]</strong></h3>

            @include('[% path_to_view_home %]fields-list', [
                'withValidation' => true,
                'withPathId' => true,
            ])

            <hr>
            <h3><strong>[% response_title %]</strong></h3>
            <p>[% update_route_response_description %]</p>
            <p></p>
            
            @include('[% path_to_view_home %]retrieved')
            @include('[% path_to_view_home %]failed-to-retrieve')
            @include('[% path_to_view_home %]failed-validation')
            [% include_failed_authentication_for_authorized_request %]

        </div>
    </div>
</div>



<div class="card mb-3" id="show-documentation">

    <div class="card-header text-bg-info d-flex justify-content-between align-items-center p-3">
        <div>
            <span class="">GET</span>
            <span><strong>/{{ Route::getRoutes()->getByName('[% show_route_name %]')->uri() }}</strong></span>
            <p class="mb-0">[% show_route_description %]</p>
        </div>
        <div>
            <button type="button" data-bs-toggle="collapse" data-bs-target="#show" aria-controls="show" class="btn btn-info btn-sm" aria-expanded="false">
                <span class="fa-solid fa-chevron-down"></span>
            </button>
        </div>
    </div>

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

        <h3><strong>[% request_title %]</strong></h3>
        
        <table class="table table-stripped">
            <thead>
                <tr>
                    <th class="col-md-2">[% parameter_name_title %]</th>
                    <th class="col-md-2">[% data_type_title %]</th>
                    <th class="col-md-2">[% parameter_type_title %]</th>
                    <th class="col-md-6">[% description_title %]</th>
                </tr>
            </thead>
            <tbody>
                [% include_parameter_for_authorized_request %]
                <tr>
                    <td>[% model_name %]</td>
                    <td>[% integer_title %]</td>
                    <td><span class="label label-info" title="[% this_parameter_is_part_of_the_path %]">[% path_title %]</span></td>
                    <td>[% the_id_of_model_to_retrieve %]</td>
                </tr>
            </tbody>
        </table>


        <hr>
        <h3><strong>[% response_title %]</strong></h3>
        <p>[% show_route_response_description %] </p>
        <p></p>

        @include('[% path_to_view_home %]retrieved')
        @include('[% path_to_view_home %]failed-to-retrieve')
        [% include_failed_authentication_for_authorized_request %]

    </div>
</div>


<div class="card card-danger mb-3" id="destroy-documentation">

    <div class="card-header text-bg-danger d-flex justify-content-between align-items-center p-3">
        <div>
            <span class="">DELETE</span>
            <span><strong>/{{ Route::getRoutes()->getByName('[% destroy_route_name %]')->uri() }}</strong></span>
            <p class="mb-0">[% destroy_route_description %]</p>
        </div>
        <div>
            <button type="button" data-bs-toggle="collapse" data-bs-target="#destroy" aria-controls="destroy" class="btn btn-danger btn-sm" aria-expanded="false">
                <span class="fa-solid fa-chevron-down"></span>
            </button>
        </div>
    </div>

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

        <h3><strong>[% request_title %]</strong></h3>

        <table class="table table-stripped">
            <thead>
                <tr>
                    <th class="col-md-2">[% parameter_name_title %]</th>
                    <th class="col-md-2">[% data_type_title %]</th>
                    <th class="col-md-2">[% parameter_type_title %]</th>
                    <th class="col-md-6">[% description_title %]</th>
                </tr>
            </thead>
            <tbody>
                [% include_parameter_for_authorized_request %]
                <tr>
                    <td>[% model_name %]</td>
                    <td>[% integer_title %]</td>
                    <td><span class="label label-info" title="[% this_parameter_is_part_of_the_path %]">[% path_title %]</span></td>
                    <td>[% the_id_of_model_to_delete %]</td>
                </tr>
            </tbody>
        </table>


        <hr>
        <h3><strong>[% response_title %]</strong></h3>
        <p>[% destroy_route_response_description %]</p>
        <p></p>

        @include('[% path_to_view_home %]retrieved')
        @include('[% path_to_view_home %]failed-to-retrieve')
        [% include_failed_authentication_for_authorized_request %]

    </div>

</div>

<hr>

<h2>[% model_definition_title %]</h2>
<div class="card" id="[% model_name %]-model-documentation">

    <div class="card-header text-bg-secondary d-flex justify-content-between align-items-center p-3">
        <div>
            <span class="">[% model_name_title %]</span>
        </div>
        <div>
            <button type="button" data-bs-toggle="collapse" data-bs-target="#model-definitions" aria-controls="model-definitions" class="btn btn-secondary btn-sm" aria-expanded="false">
                <span class="fa-solid fa-chevron-down"></span>
            </button>
        </div>
    </div>

    <div class="card-body collapse" id="model-definitions">
        <table class="table table-stripped">
            <thead>
                <tr>
                    <th>[% field_name_title %]</th>
                    <th>[% field_type_title %]</th>
                    <th>[% description_title %]</th>
                </tr>
            </thead>
            <tbody>
            [% fields_list_for_body %]
            </tbody>
        </table>
    </div>
</div>

@endsection
