using System;
using System.Collections.Generic;

namespace OnlineSalesAutoCrop.CoreAPI.Models.Requests.MobileApp;

public class SaveOrderRequest
{
    public SaveOrderRequest()
    {
        Items = new List<SaveOrderItemRequest>();
    }

    public int? OrderId { get; set; }
    public string? OrderNo { get; set; }
    public DateTime? OrderDate { get; set; }
    public DateTime? ExpectedDeliveryDate { get; set; }
    public Guid UUID { get; set; }
    public string SalesOrgCode { get; set; }
    public int? CustomerId { get; set; }
    public string CustomerCode { get; set; }
    public string CustomerName { get; set; }
    public int? EmployeeId { get; set; }
    public string EmployeeCode { get; set; }
    public string? ReferenceTxtNo { get; set; } 
    public string PaymentTermCode { get; set; }
    public string DiscountCode { get; set; }
    public string FocCode { get; set; }
    public decimal FocValue { get; set; }
    public decimal DiscountValue { get; set; }
    public decimal GrossValue { get; set; }
    public decimal NetValue { get; set; }
    public OrderStatusEnum OrderStatus { get; set; }
    public IList<SaveOrderItemRequest> Items { get; set; }
}

public class SaveOrderItemRequest
{
    public int? OrderId { get; set; }
    public int? ItemId { get; set; }
    public int? MaterialId { get; set; }
    public string MaterialCode { get; set; }
    public string MaterialName { get; set; }
    public decimal UnitPrice { get; set; }   
    public string SalesUnit { get; set; }
    public decimal PromoQuantity { get; set; }
    public decimal OrderQuantity { get; set; }
    public decimal ValidatedQuantity { get; set; }
    public decimal ApprovedQuantity { get; set; }
    public decimal DiscountPercentage { get; set; }
    public decimal DiscountAmount { get; set; }
    public bool IsFocItem { get; set; }
    public decimal LineTotalValue { get; set; }
}

public class SaveOrderPromotionRequest
{
    public int ItemId { get; set; }
    public int OrderId { get; set; }
    public int MaterialId { get; set; }
    public string PromotionCode { get; set; }
    public decimal DiscountPercentage { get; set; }
    public decimal DiscountValue { get; set; }
    public decimal ForQuantity { get; set; }
    public decimal OrderFocQty { get; set; }
    public decimal ValidatedFocQty { get; set; }
    public decimal ApprovedFocQty { get; set; }
    public int PromotionType { get; set; }
}

public class GetOrderSummaryRequest : PagedRequest
{
    public string? SalesOrgCode { get; set; } 
    public string? EmployerCode { get; set; }
    public string? OrderNo { get; set; }
    public string? UUID { get; set; }
    public string? CustomerCode { get; set; }
    public DateTime? StartDate { get; set;  }
    public DateTime? EndDate { get; set; }
    public OrderStatusEnum? OrderStatus { get; set; }
}

public class UpdateSapDetailsRequest
{
    public int OrderId { get; set; }
    public SAPOrderStatusEnum Status { get; set; }
    public DateTime SentAt { get; set; }
    public int RetryCount { get; set; }
    public string LastError { get; set; }
    public string ReturnMessage { get; set; }
}