using Microsoft.AspNetCore.Mvc.Rendering;
using Nop.Web.Framework.Models;
using Nop.Web.Framework.Mvc.ModelBinding;

namespace Nop.Web.Models.Catalog;

public partial record SearchModel : BaseNopModel
{
    public SearchModel()
    {
        AvailableCategories = new List<SelectListItem>();
        AvailableManufacturers = new List<SelectListItem>();
        AvailableVendors = new List<SelectListItem>();
        CatalogProductsModel = new CatalogProductsModel();
    }

    /// <summary>
    /// Query string
    /// </summary>
    [NopResourceDisplayName("Search.SearchTerm")]
    public string q { get; set; }

    /// <summary>
    /// Category ID
    /// </summary>
    [NopResourceDisplayName("Search.Category")]
    public int cid { get; set; }

    [NopResourceDisplayName("Search.IncludeSubCategories")]
    public bool isc { get; set; }

    /// <summary>
    /// Manufacturer ID
    /// </summary>
    [NopResourceDisplayName("Search.Manufacturer")]
    public int mid { get; set; }

    /// <summary>
    /// Vendor ID
    /// </summary>
    [NopResourceDisplayName("Search.Vendor")]
    public int vid { get; set; }

    /// <summary>
    /// A value indicating whether to search in descriptions
    /// </summary>
    [NopResourceDisplayName("Search.SearchInDescriptions")]
    public bool sid { get; set; }

    /// <summary>
    /// A value indicating whether "advanced search" is enabled
    /// </summary>
    [NopResourceDisplayName("Search.AdvancedSearch")]
    public bool advs { get; set; }

    /// <summary>
    /// A value indicating whether "allow search by vendor" is enabled
    /// </summary>
    public bool asv { get; set; }

    public CatalogProductsModel CatalogProductsModel { get; set; }

    public IList<SelectListItem> AvailableCategories { get; set; }
    public IList<SelectListItem> AvailableManufacturers { get; set; }
    public IList<SelectListItem> AvailableVendors { get; set; }

    #region Nested classes

    public partial record CategoryModel : BaseNopEntityModel
    {
        public string Breadcrumb { get; set; }
    }

    #endregion
}