using System;
using System.Collections.Generic;

namespace OnlineSalesAutoCrop.CoreAPI.Models.Responses.MobileApp;

public class SaveOrderResponse 
{
    public int OrderId { get; set; }
    public string OrderNo { get; set; }
    public DateTime OrderDate { get; set; }
    public Guid UUID { get; set; }
    public bool IsNewOrder { get; set; }
}

public class OrderBasicResponse
{
    public int OrderId { get; set; }
    public string OrderNo { get; set; }
    public DateTime OrderDate { get; set; }
    public Guid UUID { get; set; }
    public OrderStatusEnum OrderStatus { get; set; }
}

public class GetSalesOrderResponse
{
    public int OrderId { get; set; }    
    public Guid Uuid { get; set; }
    public string OrderNo { get; set; }
    public DateTime OrderDate { get; set; }   
    public string SalesOrgCode { get; set; }
    public string CustomerCode { get; set; }
    public string CustomerName { get; set; }
    public string? ReferenceTxtNo { get; set; }
    public string EmployeeCode { get; set; }
    public DateTime? ExpectedDeliveryDate { get; set; }
    public string PaymentTermCode { get; set; }
    public string DiscountCode { get; set; }
    public string FocCode { get; set; }
    public decimal DiscountValue { get; set; }
    public decimal GrossValue { get; set; }
    public decimal NetValue { get; set; }
    public int OrderStatus { get; set; }

    public List<GetSalesOrderItemResponse> Items { get; set; } = new();
}

public class GetSalesOrderItemResponse
{
    public int OrderId { get; set; }
    public Guid UUID { 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 GetOrderPromotionResponse
{
    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 OrderFocQuantity { get; set; }
    public decimal ValidatedFocQuantity { get; set; }
    public decimal ApprovedFocQuantity { get; set; }
    public int PromotionType { get; set; }
}


public sealed class UserRoleDto
{
    public int UserId { get; set; }
    public UserRoleTypeEnum RoleId { get; set; }
}

public sealed class CustomerLookupDto
{
    public int CustomerId { get; set; }
    public string CustomerCode { get; set; } = string.Empty;
    public string CustomerName { get; set; } = string.Empty;
}

public sealed class PaymentTermLookupDto
{
    public int PaymentTermId { get; set; }
    public string PaymentTermCode { get; set; } = string.Empty;
}

public sealed class DiscountLookupDto
{
    public int DiscountId { get; set; }
    public string DiscountCode { get; set; } = string.Empty;
}

public sealed class MaterialLookupDto
{
    public int MaterialId { get; set; }
    public string MaterialCode { get; set; } = string.Empty;
    public string MaterialName { get; set; } = string.Empty;
}

public sealed class FreeGoodsRuleDto
{
    public int FreeGoodsId { get; set; }
    public int MaterialId { get; set; }
    public decimal MinOrderQuantity { get; set; }
    public decimal ForQuantity { get; set; }
    public decimal FreeQuantity { get; set; }
    public string UnitOfMeasure { get; set; } = string.Empty;
    public string FocUnitOfMeasure { get; set; } = string.Empty;
}

public class GetOrderForSAPResponse
{
    public GetOrderForSAPResponse()
    {
        to_Item = new List<GetOrderItemForSAPResponse>();
    }

    public string SalesOrderType { get; set; }
    public string SalesOrganization { get; set; }
    public string DistributionChannel { get; set; }
    public string OrganizationDivision { get; set; }
    public string SoldToParty { get; set; }
    public string PurchaseOrderByCustomer { get; set; }
    public string CustomerPurchaseOrderDate { get; set; }
    public string PurchaseOrderByShipToParty { get; set; }
    public string CustomerPaymentTerms { get; set; }
    public string? CustomerGroup { get; set; }
    public string? CustomerPriceGroup { get; set; }
    public IList<GetOrderItemForSAPResponse> to_Item  { get; set; }
}

public class GetOrderItemForSAPResponse
{
    public string Material { get; set; }    
    public string RequestedQuantity { get; set; }    
}