using System;
using System.ComponentModel.DataAnnotations;

namespace OnlineSalesAutoCrop.CoreAPI.Models.Requests.Integrations;

public class IntegrationMaterialFreeGoodsRequest
{

    [Required(ErrorMessage = "SalesOrg is required.")]
    [StringLength(4, MinimumLength = 1, ErrorMessage = "SalesOrg must be between 1 and 4 characters.")]
    public string SalesOrg { get; set; }

    [Required(ErrorMessage = "DistributionChannel is required.")]
    [StringLength(2, MinimumLength = 1, ErrorMessage = "DistributionChannel must be between 1 and 2 characters.")]
    public string DistributionChannel { get; set; }

    [StringLength(13, MinimumLength = 1, ErrorMessage = "CustomerNumber must be between 1 and 13 characters.")]
    public string? CustomerNumber { get; set; }   // nullable

    [StringLength(2, MinimumLength = 1, ErrorMessage = "CustomerPriceGroup must be between 1 and 2 characters.")]
    public string? CustomerPriceGroup { get; set; }

    [Required(ErrorMessage = "MaterialCode is required.")]
    [StringLength(10, MinimumLength = 1, ErrorMessage = "MaterialCode must be between 1 and 10 characters.")]
    public string MaterialCode { get; set; }

    [Required(ErrorMessage = "MinOrderQuantity is required.")]
    [Range(0.001, 9999999999999.999, ErrorMessage = "MinOrderQuantity must be greater than 0.")]
    public decimal MinOrderQuantity { get; set; }

    [Required(ErrorMessage = "ForQuantity is required.")]
    [Range(0.001, 9999999999999.999, ErrorMessage = "ForQuantity must be greater than 0.")]
    public decimal ForQuantity { get; set; }

    [Required(ErrorMessage = "UnitOfMeasure is required.")]
    [StringLength(3, MinimumLength = 1, ErrorMessage = "UnitOfMeasure must be between 1 and 3 characters.")]
    public string UnitOfMeasure { get; set; }

    [Required(ErrorMessage = "FreeQuantity is required.")]
    [Range(0.001, 9999999999999.999, ErrorMessage = "FreeQuantity must be greater than 0.")]
    public decimal FreeQuantity { get; set; }

    [Required(ErrorMessage = "FocUnitOfMeasure is required.")]
    [StringLength(3, MinimumLength = 1, ErrorMessage = "FocUnitOfMeasure must be between 1 and 3 characters.")]
    public string FocUnitOfMeasure { get; set; }

    [Required(ErrorMessage = "ValidFrom is required.")]
    public DateOnly ValidFrom { get; set; }

    [Required(ErrorMessage = "ValidTo is required.")]
    public DateOnly ValidTo { get; set; }

    [StringLength(1, MinimumLength = 1, ErrorMessage = "Status must be 1 character.")]
    public string? Status { get; set; }   // NULL = Active, X = Inactive
}


public class GetMaterialFreeGoodsByFilterRequest
{
    [Required(ErrorMessage = "SalesOrg is required.")]
    [StringLength(4, MinimumLength = 1, ErrorMessage = "SalesOrg must be between 1 and 4 characters.")]
    public string SalesOrg { get; set; }

    [Required(ErrorMessage = "DistributionChannel is required.")]
    [StringLength(2, MinimumLength = 1, ErrorMessage = "DistributionChannel must be between 1 and 2 characters.")]
    public string DistributionChannel { get; set; }

    [StringLength(13, MinimumLength = 1, ErrorMessage = "CustomerNumber must be between 1 and 13 characters.")]
    public string? CustomerNumber { get; set; }   // nullable

    [StringLength(2, MinimumLength = 1, ErrorMessage = "CustomerPriceGroup must be between 1 and 2 characters.")]
    public string? CustomerPriceGroup { get; set; }

    [Required(ErrorMessage = "MaterialCode is required.")]
    [StringLength(10, MinimumLength = 1, ErrorMessage = "MaterialCode must be between 1 and 10 characters.")]
    public string MaterialCode { get; set; }
}