namespace LittleShop.Client.Models;

public class Order
{
    public Guid Id { get; set; }
    public Guid? CustomerId { get; set; }
    public string? IdentityReference { get; set; }
    public int Status { get; set; }
    public decimal TotalAmount { get; set; }
    public string Currency { get; set; } = string.Empty;
    public string ShippingName { get; set; } = string.Empty;
    public string ShippingAddress { get; set; } = string.Empty;
    public string ShippingCity { get; set; } = string.Empty;
    public string ShippingPostCode { get; set; } = string.Empty;
    public string ShippingCountry { get; set; } = string.Empty;
    public string? Notes { get; set; }
    public string? TrackingNumber { get; set; }
    public List<OrderItem> Items { get; set; } = new();
    public List<CryptoPayment> Payments { get; set; } = new();
    public DateTime CreatedAt { get; set; }
    public DateTime UpdatedAt { get; set; }
    public DateTime? PaidAt { get; set; }
    public DateTime? ShippedAt { get; set; }
}

public class OrderItem
{
    public Guid Id { get; set; }
    public Guid ProductId { get; set; }
    public string? ProductName { get; set; }
    public int Quantity { get; set; }
    public decimal UnitPrice { get; set; }
    public decimal TotalPrice { get; set; }
}

public class CreateOrderRequest
{
    // Either Customer ID (for registered customers) OR Identity Reference (for anonymous)
    public Guid? CustomerId { get; set; }
    public string? IdentityReference { get; set; }
    
    // Customer Information (collected at checkout for new customers)
    public CreateCustomerRequest? CustomerInfo { get; set; }
    
    public string ShippingName { get; set; } = string.Empty;
    public string ShippingAddress { get; set; } = string.Empty;
    public string ShippingCity { get; set; } = string.Empty;
    public string ShippingPostCode { get; set; } = string.Empty;
    public string ShippingCountry { get; set; } = "United Kingdom";
    public string? Notes { get; set; }
    public List<CreateOrderItem> Items { get; set; } = new();
}

public class CreateOrderItem
{
    public Guid ProductId { get; set; }
    public int Quantity { get; set; }
}