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

namespace Nop.Web.Areas.Admin.Models.Discounts;

/// <summary>
/// Represents a discount model
/// </summary>
public partial record DiscountModel : BaseNopEntityModel
{
    #region Ctor

    public DiscountModel()
    {
        AvailableDiscountRequirementRules = new List<SelectListItem>();
        AvailableRequirementGroups = new List<SelectListItem>();
        DiscountUsageHistorySearchModel = new DiscountUsageHistorySearchModel();
        DiscountProductSearchModel = new DiscountProductSearchModel();
        DiscountCategorySearchModel = new DiscountCategorySearchModel();
        DiscountManufacturerSearchModel = new DiscountManufacturerSearchModel();
    }

    #endregion

    #region Properties

    [NopResourceDisplayName("Admin.Promotions.Discounts.Fields.Name")]
    public string Name { get; set; }

    [NopResourceDisplayName("Admin.Promotions.Discounts.Fields.AdminComment")]
    public string AdminComment { get; set; }

    [NopResourceDisplayName("Admin.Promotions.Discounts.Fields.DiscountType")]
    public int DiscountTypeId { get; set; }

    [NopResourceDisplayName("Admin.Promotions.Discounts.Fields.DiscountType")]
    public string DiscountTypeName { get; set; }

    //used for the list page
    [NopResourceDisplayName("Admin.Promotions.Discounts.Fields.TimesUsed")]
    public int TimesUsed { get; set; }

    [NopResourceDisplayName("Admin.Promotions.Discounts.Fields.UsePercentage")]
    public bool UsePercentage { get; set; }

    [NopResourceDisplayName("Admin.Promotions.Discounts.Fields.DiscountPercentage")]
    public decimal DiscountPercentage { get; set; }

    [NopResourceDisplayName("Admin.Promotions.Discounts.Fields.DiscountAmount")]
    public decimal DiscountAmount { get; set; }

    [NopResourceDisplayName("Admin.Promotions.Discounts.Fields.MaximumDiscountAmount")]
    [UIHint("DecimalNullable")]
    public decimal? MaximumDiscountAmount { get; set; }

    public string PrimaryStoreCurrencyCode { get; set; }

    [NopResourceDisplayName("Admin.Promotions.Discounts.Fields.StartDate")]
    [UIHint("DateTimeNullable")]
    public DateTime? StartDateUtc { get; set; }

    [NopResourceDisplayName("Admin.Promotions.Discounts.Fields.EndDate")]
    [UIHint("DateTimeNullable")]
    public DateTime? EndDateUtc { get; set; }

    [NopResourceDisplayName("Admin.Promotions.Discounts.Fields.IsActive")]
    public bool IsActive { get; set; }

    [NopResourceDisplayName("Admin.Promotions.Discounts.Fields.RequiresCouponCode")]
    public bool RequiresCouponCode { get; set; }

    [NopResourceDisplayName("Admin.Promotions.Discounts.Fields.DiscountUrl")]
    public string DiscountUrl { get; set; }

    [NopResourceDisplayName("Admin.Promotions.Discounts.Fields.CouponCode")]
    public string CouponCode { get; set; }

    [NopResourceDisplayName("Admin.Promotions.Discounts.Fields.IsCumulative")]
    public bool IsCumulative { get; set; }

    [NopResourceDisplayName("Admin.Promotions.Discounts.Fields.DiscountLimitation")]
    public int DiscountLimitationId { get; set; }

    [NopResourceDisplayName("Admin.Promotions.Discounts.Fields.LimitationTimes")]
    public int LimitationTimes { get; set; }

    [NopResourceDisplayName("Admin.Promotions.Discounts.Fields.MaximumDiscountedQuantity")]
    [UIHint("Int32Nullable")]
    public int? MaximumDiscountedQuantity { get; set; }

    [NopResourceDisplayName("Admin.Promotions.Discounts.Fields.AppliedToSubCategories")]
    public bool AppliedToSubCategories { get; set; }

    [NopResourceDisplayName("Admin.Promotions.Discounts.Requirements.DiscountRequirementType")]
    public string AddDiscountRequirement { get; set; }

    public IList<SelectListItem> AvailableDiscountRequirementRules { get; set; }

    [NopResourceDisplayName("Admin.Promotions.Discounts.Requirements.GroupName")]
    public string GroupName { get; set; }

    [NopResourceDisplayName("Admin.Promotions.Discounts.Requirements.RequirementGroup")]
    public int RequirementGroupId { get; set; }

    public IList<SelectListItem> AvailableRequirementGroups { get; set; }

    public DiscountUsageHistorySearchModel DiscountUsageHistorySearchModel { get; set; }

    public DiscountProductSearchModel DiscountProductSearchModel { get; set; }

    public DiscountCategorySearchModel DiscountCategorySearchModel { get; set; }

    public DiscountManufacturerSearchModel DiscountManufacturerSearchModel { get; set; }

    #endregion
}