package com.example.petstoremobile.dtos;

import java.math.BigDecimal;
import java.util.List;

public class SaleDTO {
    // Response fields
    private Long saleId;
    private String saleDate;
    private Long employeeId;
    private String employeeName;
    private Long customerId;
    private String customerName;
    private Long storeId;
    private String storeName;
    private BigDecimal totalAmount;
    private BigDecimal subtotalAmount;
    private BigDecimal couponDiscountAmount;
    private BigDecimal employeeDiscountAmount;
    private BigDecimal loyaltyDiscountAmount;
    private BigDecimal pointsDiscountAmount;
    private Integer pointsUsed;
    private String paymentMethod;
    private String channel;
    private Boolean isRefund;
    private Long originalSaleId;
    private Long cartId;
    private Long couponId;
    private Integer pointsEarned;
    private List<SaleItemDTO> items;
    private String createdAt;

    // Constructor for create request
    public SaleDTO(Long storeId, String paymentMethod, List<SaleItemDTO> items,
                   Boolean isRefund, Long originalSaleId, Long customerId) {
        this.storeId = storeId;
        this.paymentMethod = paymentMethod;
        this.items = items;
        this.isRefund = isRefund;
        this.originalSaleId = originalSaleId;
        this.customerId = customerId;
    }

    public Long getSaleId() {
        return saleId;
    }

    public String getSaleDate() {
        return saleDate;
    }

    public Long getEmployeeId() {
        return employeeId;
    }

    public String getEmployeeName() {
        return employeeName;
    }

    public Long getStoreId() {
        return storeId;
    }

    public String getStoreName() {
        return storeName;
    }

    public BigDecimal getTotalAmount() {
        return totalAmount;
    }

    public BigDecimal getSubtotalAmount() {
        return subtotalAmount;
    }

    public BigDecimal getCouponDiscountAmount() {
        return couponDiscountAmount;
    }

    public BigDecimal getEmployeeDiscountAmount() {
        return employeeDiscountAmount;
    }

    public BigDecimal getLoyaltyDiscountAmount() {
        return loyaltyDiscountAmount;
    }

    public void setLoyaltyDiscountAmount(BigDecimal loyaltyDiscountAmount) {
        this.loyaltyDiscountAmount = loyaltyDiscountAmount;
    }

    public Integer getPointsUsed() {
        return pointsUsed;
    }

    public void setPointsUsed(Integer pointsUsed) {
        this.pointsUsed = pointsUsed;
    }

    public String getPaymentMethod() {
        return paymentMethod;
    }

    public String getChannel() {
        return channel;
    }

    public Boolean getIsRefund() {
        return isRefund;
    }

    public Long getOriginalSaleId() {
        return originalSaleId;
    }

    public Long getCartId() {
        return cartId;
    }

    public Long getCouponId() {
        return couponId;
    }

    public void setCouponId(Long couponId) {
        this.couponId = couponId;
    }

    public Integer getPointsEarned() {
        return pointsEarned;
    }

    public List<SaleItemDTO> getItems() {
        return items;
    }

    public String getCreatedAt() {
        return createdAt;
    }

    public Long getCustomerId() {
        return customerId;
    }

    public String getCustomerName() {
        return customerName;
    }

    public BigDecimal getPointsDiscountAmount() {
        return pointsDiscountAmount;
    }

    public void setPointsDiscountAmount(BigDecimal pointsDiscountAmount) {
        this.pointsDiscountAmount = pointsDiscountAmount;
    }

    // Nested SaleItemDTO
    public static class SaleItemDTO {
        private Long saleItemId;
        private Long prodId;
        private String productName;
        private Integer quantity;
        private BigDecimal unitPrice;

        // Constructor for request
        public SaleItemDTO(Long prodId, Integer quantity) {
            this.prodId = prodId;
            this.quantity = quantity;
        }

        public Long getSaleItemId() {
            return saleItemId;
        }

        public Long getProdId() {
            return prodId;
        }

        public String getProductName() {
            return productName;
        }

        public Integer getQuantity() {
            return quantity;
        }

        public BigDecimal getUnitPrice() {
            return unitPrice;
        }
    }
}
