using System;
using System.ComponentModel.DataAnnotations;

namespace OnlineSalesAutoCrop.CoreAPI.Models.Requests.Integrations;

public class IntegrationMaterialPriceRequest
{
    [Required(ErrorMessage = "Sales Org is required.")]
    [StringLength(4, ErrorMessage = "Sales Org cannot exceed 4 characters.")]
    public string SalesOrg { get; set; }

    [Required(ErrorMessage = "Distribution Channel is required.")]
    [StringLength(2, ErrorMessage = "Distribution Channel cannot exceed 2 characters.")]
    public string DistributionChannel { get; set; }

    [StringLength(13, ErrorMessage = "Customer Number cannot exceed 13 characters.")]
    public string? CustomerNumber { get; set; }

    [StringLength(10, ErrorMessage = "Customer Group Code cannot exceed 10 characters.")]
    public string? CustomerGroupCode { get; set; }

    [Required(ErrorMessage = "Material Code is required.")]
    [StringLength(10, ErrorMessage = "Material Code cannot exceed 10 characters.")]
    public string MaterialCode { get; set; }

    [Required(ErrorMessage = "Condition Type is required.")]
    [StringLength(4, ErrorMessage = "Condition Type cannot exceed 4 characters.")]
    public string ConditionType { get; set; }

    [Required(ErrorMessage = "Calculation Type is required.")]
    [StringLength(1, ErrorMessage = "Calculation Type cannot exceed 1 character.")]
    public string CalculationType { get; set; }

    [Required(ErrorMessage = "Pricing Unit is required.")]
    [StringLength(1, ErrorMessage = "Pricing Unit cannot exceed 1 character.")]
    public string PricingUnit { get; set; }

    [Required(ErrorMessage = "Unit Of Measure is required.")]
    [StringLength(3, ErrorMessage = "Unit Of Measure cannot exceed 3 characters.")]
    public string UnitOfMeasure { get; set; }

    [Required(ErrorMessage = "Valid From date is required.")]
    public DateTime ValidFrom { get; set; }

    [Required(ErrorMessage = "Valid To date is required.")]
    public DateTime ValidTo { get; set; }

    [StringLength(1, ErrorMessage = "Status cannot exceed 1 character.")]
    [RegularExpression(@"^$|^X$", ErrorMessage = "Status must be blank (Active) or 'X' (Inactive).")]
    public string Status { get; set; }

    [Required(ErrorMessage = "Condition Value is required.")]
    [Range(typeof(decimal), "0", "999999999999999999.99",
        ErrorMessage = "Condition Value must be greater than or equal to 0.")]
    public decimal ConditionValue { get; set; }
}

public class GetMaterialPriceByCodeRequest
{
    [Required(ErrorMessage = "Sales Org is required.")]
    [StringLength(4, ErrorMessage = "Sales Org cannot exceed 4 characters.")]
    public string SalesOrg { get; set; }

    [Required(ErrorMessage = "Material Code is required.")]
    [StringLength(10, ErrorMessage = "Material Code cannot exceed 10 characters.")]
    public string MaterialCode { get; set; }

    [Required(ErrorMessage = "Condition Type is required.")]
    [StringLength(4, ErrorMessage = "Condition Type cannot exceed 4 characters.")]
    public string ConditionType { get; set; }

    [StringLength(13, ErrorMessage = "Customer Number cannot exceed 13 characters.")]
    public string? CustomerNumber { get; set; }

    [StringLength(10, ErrorMessage = "Customer Group Code cannot exceed 10 characters.")]
    public string? CustomerGroupCode { get; set; }
}