@using StubCore.Entities
@model StubAP.ViewModels.DashboardViewModel

<section class="st_profiles">

    @{
        if (Model._profiles != null && Model._profiles.Count > 0)
        {
            <div class="st_profile_list">
                <ul>
                    @foreach (ProfileItem item in Model._profiles)
                    {
                        <li id="@item.id" class="@item.outputTransport.ToLower()">
                            <div class="st_item">
                                <div class="st_profile_header">
                                    <div class="st_head_left">
                                        <div class="st_name">@item.name</div>
                                        <div class="st_slug">@item.nameID</div>
                                    </div>
                                    <div class="st_head_right">@item.outputTransport</div>
                                </div>
                                <div class="st_profile_description">
                                    <div class="st_description_inner">@item.description</div>
                                </div>
                                <div class="st_profile_summary">
                                    <div class="st_summary_inner">

                                        @{ 
                                            var fileString = item.containsFiles > 1 ? "files" : "file";
                                            var nodeString = item.containsNodes > 1 ? "nodes" : "node";
                                            var valueString = item.containsValues > 1 ? "values" : "value";

                                            var includes_files = String.Format("Includes {0} {1}", item.containsFiles, fileString);
                                            var includes_nodes = String.Format("{0} {1} with {2} {3}", item.containsNodes, nodeString, item.containsValues, valueString);
                                        }

                                        <div class="st_summary_files">@includes_files</div>
                                        <div class="st_summary_nodes">@includes_nodes</div>
                                    </div>
                                </div>
                                <div class="st_profile_action">
                                    @Html.ActionLink("Edit", "edit", "profile", new { id = item.id }, new { @class = "st_action edit" })
                                    @Html.ActionLink("Delete", "delete", "profile", new { id = item.id }, new { @class = "st_action delete" })
                                    <!--
                                    <div class="st_action edit"></div>
                                    <div class="st_action delete">Delete</div>
                                    -->
                                </div>
                            </div>
                        </li>
                    }
                </ul>
            </div>
        }
        else
        {
            <div class="st_profile_list_empty">
                <div class="notice">The profile list is empty. Please use migration tool to move old profiles or create new.</div>
            </div>
        }
    }
</section>