@model CreateShowListViewModel
@inject UserManager<User> userManager
@inject IUserLimitService UserLimitService

@{
    ViewData["Title"] = "Show list";
    ViewData["Message"] = "Create a new list for shows";
}

<partial name="_LimitNotification" />

<div class="row">
    <div class="col-md-12">
        <form asp-action="ShowList" method="post">

            <div class="card">
                <div class="card-body">
                    <h5 class="card-title">Basic filters</h5>
                    <h6 class="card-subtitle mb-2 text-muted">Filter for basic information on the Trakt API</h6>

                    <hr />

                    <div class="row">
                        <div class="col-md-6">
                            <div class="form-group">
                                <input asp-for="Name" class="form-control" />
                                <small class="form-text text-muted">* Give your list a name that matches your filters to find it easier after creating.</small>
                                <span asp-validation-for="Name" class="text-danger"></span>
                            </div>
                            <div class="form-group">
                                <input asp-for="Query" class="form-control" />
                                <small class="form-text text-muted">Searches for the input in the sections marked below.</small>
                                <span asp-validation-for="Query" class="text-danger"></span>
                            </div>
                            <div class="checkbox">
                                <div class="row">
                                    <div class="col-md-6">
                                        <label>
                                            <input asp-for="SearchByAlias" /> @Html.DisplayNameFor(m => m.SearchByAlias)
                                        </label>
                                    </div>
                                    <div class="col-md-6">
                                        <label>
                                            <input asp-for="SearchByBiography" /> @Html.DisplayNameFor(m => m.SearchByBiography)
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="checkbox">
                                <div class="row">
                                    <div class="col-md-6">
                                        <label>
                                            <input asp-for="SearchByDescription" /> @Html.DisplayNameFor(m => m.SearchByDescription)
                                        </label>
                                    </div>
                                    <div class="col-md-6">
                                        <label>
                                            <input asp-for="SearchByName" /> @Html.DisplayNameFor(m => m.SearchByName)
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="checkbox">
                                <div class="row">
                                    <div class="col-md-6">
                                        <label>
                                            <input asp-for="SearchByOverview" /> @Html.DisplayNameFor(m => m.SearchByOverview)
                                        </label>
                                    </div>
                                    <div class="col-md-6">
                                        <label>
                                            <input asp-for="SearchByPeople" /> @Html.DisplayNameFor(m => m.SearchByPeople)
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="checkbox">
                                <div class="row">
                                    <div class="col-md-6">
                                        <label>
                                            <input asp-for="SearchByTitle" /> @Html.DisplayNameFor(m => m.SearchByTitle)
                                        </label>
                                    </div>
                                    <div class="col-md-6">
                                        <label>
                                            <input asp-for="SearchByTranslations" /> @Html.DisplayNameFor(m => m.SearchByTranslations)
                                        </label>
                                    </div>
                                </div>
                            </div>
                            <div class="form-group">
                                <select asp-for="Filter_Translations" asp-items="Model.Languages" class="form-control select2" multiple data-placeholder="Select a translation"></select>
                                <small class="form-text text-muted">Select the languages that a show has to have translatins for</small>
                                <span asp-validation-for="Filter_Translations" class="text-danger"></span>
                            </div>
                            <div class="form-group">
                                <select asp-for="Filter_Genres" asp-items="Model.Genres" class="form-control select2" multiple data-placeholder="Select a genre"></select>
                                <small class="form-text text-muted">Select the genres a show should have</small>
                                <span asp-validation-for="Filter_Genres" class="text-danger"></span>
                            </div>
                            <div class="form-group">
                                <select asp-for="Filter_Networks" asp-items="Model.Networks" class="form-control select2" multiple data-placeholder="Select a network"></select>
                                <small class="form-text text-muted">Networks filter e.g. <code>netflix,amazon</code> for shows that are available on netflix and amazon</small>
                                <span asp-validation-for="Filter_Networks" class="text-danger"></span>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="input-group mb-3">
                                <div class="input-group">
                                    <div class="input-group-prepend">
                                        <span class="input-group-text">Between</span>
                                    </div>
                                    <input asp-for="Filter_Years.From" value="1910" class="form-control" />
                                    <div class="input-group-prepend">
                                        <span class="input-group-text" style="border-left: 0; border-right: 0;">and</span>
                                    </div>
                                    <input asp-for="Filter_Years.To" value="@DateTime.Now.Year" class="form-control" />
                                </div>
                                <small class="form-text text-muted">Years filter e.g. <code>2000-2010</code></small>
                                <span asp-validation-for="Filter_Years.From" class="text-danger"></span>
                                <span asp-validation-for="Filter_Years.To" class="text-danger"></span>
                            </div>

                            <div class="input-group mb-3">
                                <div class="input-group">
                                    <div class="input-group-prepend">
                                        <span class="input-group-text">Between</span>
                                    </div>
                                    <input asp-for="Filter_Runtimes.From" value="30" class="form-control" />
                                    <div class="input-group-prepend">
                                        <span class="input-group-text" style="border-left: 0; border-right: 0;">and</span>
                                    </div>
                                    <input asp-for="Filter_Runtimes.To" value="250" class="form-control" />
                                    <div class="input-group-append">
                                        <span class="input-group-text" style="border-left: 0;">minutes</span>
                                    </div>
                                </div>
                                <small class="form-text text-muted">Runtime filter e.g. <code>30-200</code> for shows with a runtime min. 30 and max. 200 minutes</small>
                                <span asp-validation-for="Filter_Runtimes.From" class="text-danger"></span>
                                <span asp-validation-for="Filter_Runtimes.To" class="text-danger"></span>
                            </div>

                            <div class="input-group mb-3">
                                <div class="input-group">
                                    <div class="input-group-prepend">
                                        <span class="input-group-text">Between</span>
                                    </div>
                                    <input asp-for="Filter_Ratings_Trakt.From" value="75" class="form-control" />
                                    <div class="input-group-prepend">
                                        <span class="input-group-text" style="border-left: 0; border-right: 0;">and</span>
                                    </div>
                                    <input asp-for="Filter_Ratings_Trakt.To" value="100" class="form-control" />
                                    <div class="input-group-prepend">
                                        <span class="input-group-text" style="border-left: 0; border-right: 0;">with at least</span>
                                    </div>
                                    <input asp-for="Filter_Ratings_Trakt.Votes" value="10" class="form-control" />
                                    <div class="input-group-append">
                                        <span class="input-group-text" style="border-left: 0;">votes</span>
                                    </div>
                                </div>
                                <small class="form-text text-muted">Ratings filter e.g. <code>75-100</code> for a rating between 75-100</small>
                                <span asp-validation-for="Filter_Ratings_Trakt.From" class="text-danger"></span>
                                <span asp-validation-for="Filter_Ratings_Trakt.To" class="text-danger"></span>
                            </div>

                            <div class="form-group">
                                <select asp-for="Filter_Languages" asp-items="Model.Languages" class="form-control select2" multiple data-placeholder="Select a language"></select>
                                <small class="form-text text-muted">Languages filter e.g. <code>en,de</code> for shows that are available in english and german</small>
                                <span asp-validation-for="Filter_Languages" class="text-danger"></span>
                            </div>

                            <div class="form-group">
                                <select asp-for="Filter_Countries" asp-items="Model.Countries" class="form-control select2" multiple data-placeholder="Select a country"></select>
                                <small class="form-text text-muted">Countries filter e.g. <code>us,de</code> for shows that are available in the US and germany</small>
                                <span asp-validation-for="Filter_Countries" class="text-danger"></span>
                            </div>

                            <div class="form-group">
                                <select asp-for="Filter_Certifications" asp-items="Model.Certifications" class="form-control select2" multiple data-placeholder="Select a certification"></select>
                                <small class="form-text text-muted">Certifications filter e.g. <code>g,pg</code> for kids shows.</small>
                                <span asp-validation-for="Filter_Certifications" class="text-danger"></span>
                            </div>

                            <div class="form-group">
                                <select asp-for="Filter_Status" asp-items="Model.Status" class="form-control select2" multiple data-placeholder="Select a status"></select>
                                <small class="form-text text-muted">Status filter e.g. <code>returning series, in production</code> for shows coming in near future.</small>
                                <span asp-validation-for="Filter_Status" class="text-danger"></span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <hr />

            <div class="card">
                <div class="card-body">
                    <h5 class="card-title">IMDb filters</h5>
                    <h6 class="card-subtitle mb-2 text-muted">CPU heavy filters for extensive filtering by using IMDb data</h6>

                    <hr />

                    @if (UserLimitService.Get((await userManager.GetUserAsync(User)).Level).IMDbRatings)
                    {
                        <div class="row">
                            <div class="col-md-12">
                                <div class="input-group mb-3">
                                    <div class="input-group">
                                        <div class="input-group-prepend">
                                            <span class="input-group-text">Between</span>
                                        </div>
                                        <input asp-for="Filter_Ratings_IMDb.From" value="75" class="form-control" />
                                        <div class="input-group-prepend">
                                            <span class="input-group-text" style="border-left: 0; border-right: 0;">and</span>
                                        </div>
                                        <input asp-for="Filter_Ratings_IMDb.To" value="100" class="form-control" />
                                        <div class="input-group-prepend">
                                            <span class="input-group-text" style="border-left: 0; border-right: 0;">with at least</span>
                                        </div>
                                        <input asp-for="Filter_Ratings_IMDb.Votes" value="10" class="form-control" />
                                        <div class="input-group-append">
                                            <span class="input-group-text" style="border-left: 0;">votes</span>
                                        </div>
                                    </div>
                                    <small class="form-text text-muted">Ratings filter e.g. <code>75-100</code> for a rating between 75-100</small>
                                    <span asp-validation-for="Filter_Ratings_IMDb.From" class="text-danger"></span>
                                    <span asp-validation-for="Filter_Ratings_IMDb.To" class="text-danger"></span>
                                </div>
                            </div>
                        </div>
                    }
                    else
                    {
                        @await Html.PartialAsync("_DonorPerkExplanationPartial")

                        @await Html.PartialAsync("_ReverseFiltersExplanationPartial")
                    }
                </div>
            </div>

            <hr />

            <div class="card">
                <div class="card-body">
                    <h5 class="card-title">Exclusion filters</h5>
                    <h6 class="card-subtitle mb-2 text-muted">CPU heavy filters for extensive filtering</h6>

                    <hr />

                    @if (UserLimitService.Get((await userManager.GetUserAsync(User)).Level).ExclusionFilters)
                    {
                        <div class="row">
                            <div class="col-md-6">
                                <div class="form-group">
                                    <select asp-for="ExclusionFilter_Translations" asp-items="Model.ExclusionLanguages" class="form-control select2" multiple data-placeholder="Select a translation"></select>
                                    <small class="form-text text-muted">Select the languages that you want to exclude</small>
                                    <span asp-validation-for="ExclusionFilter_Translations" class="text-danger"></span>
                                </div>
                                <div class="form-group">
                                    <select asp-for="ExclusionFilter_Genres" asp-items="Model.ExclusionGenres" class="form-control select2" multiple data-placeholder="Select a genre"></select>
                                    <small class="form-text text-muted">Select the genres that you want to exclude</small>
                                    <span asp-validation-for="ExclusionFilter_Genres" class="text-danger"></span>
                                </div>
                                <div class="form-group">
                                    <select asp-for="ExclusionFilter_Networks" asp-items="Model.ExclusionNetworks" class="form-control select2" multiple data-placeholder="Select a network"></select>
                                    <small class="form-text text-muted">Select the networks that you want to exclude</small>
                                    <span asp-validation-for="ExclusionFilter_Networks" class="text-danger"></span>
                                </div>
                                <div class="form-group">
                                    <input asp-for="ExclusionFilter_Keywords" class="form-control" />
                                    <small class="form-text text-muted">Exclude items that contain any of the given words. Seperate your words by <code>,</code> e.g <code>ufc,ww2,world war 2,disney</code>. Not case sensitive.</small>
                                    <span asp-validation-for="ExclusionFilter_Keywords" class="text-danger"></span>
                                </div>
                            </div>
                            <div class="col-md-6">
                                <div class="form-group">
                                    <select asp-for="ExclusionFilter_Languages" asp-items="Model.ExclusionLanguages" class="form-control select2" multiple data-placeholder="Select a language"></select>
                                    <small class="form-text text-muted">Select the languages that you want to exclude</small>
                                    <span asp-validation-for="ExclusionFilter_Languages" class="text-danger"></span>
                                </div>
                                <div class="form-group">
                                    <select asp-for="ExclusionFilter_Countries" asp-items="Model.ExclusionCountries" class="form-control select2" multiple data-placeholder="Select a country"></select>
                                    <small class="form-text text-muted">Select the countries that you want to exclude</small>
                                    <span asp-validation-for="ExclusionFilter_Countries" class="text-danger"></span>
                                </div>
                                <div class="form-group">
                                    <select asp-for="ExclusionFilter_Certifications" asp-items="Model.ExclusionCertifications" class="form-control select2" multiple data-placeholder="Select a certification"></select>
                                    <small class="form-text text-muted">Select the certifications that you want to exclude</small>
                                    <span asp-validation-for="ExclusionFilter_Certifications" class="text-danger"></span>
                                </div>
                                <div class="form-group">
                                    <select asp-for="ExclusionFilter_Status" asp-items="Model.ExclusionStatus" class="form-control select2" multiple data-placeholder="Select a status"></select>
                                    <small class="form-text text-muted">Select the status that you want to exclude</small>
                                    <span asp-validation-for="ExclusionFilter_Status" class="text-danger"></span>
                                </div>
                            </div>
                        </div>
                    }
                    else
                    {
                        @await Html.PartialAsync("_ReverseFiltersExplanationPartial")
                    }
                </div>
            </div>

            <hr />

            <button type="submit" class="btn btn-primary float-right">Submit</button>
        </form>
    </div>
</div>