package com.petshop.backend.dto.analytics;

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

public class DashboardResponse {
    private SalesSummary salesSummary;
    private InventorySummary inventorySummary;
    private List<TopProduct> topProducts;
    private List<DailySales> dailySales;
    private List<PaymentMethodData> paymentMethods;
    private List<EmployeePerformanceData> employeePerformance;

    public DashboardResponse() {
    }

    public DashboardResponse(SalesSummary salesSummary, InventorySummary inventorySummary, List<TopProduct> topProducts, List<DailySales> dailySales, List<PaymentMethodData> paymentMethods, List<EmployeePerformanceData> employeePerformance) {
        this.salesSummary = salesSummary;
        this.inventorySummary = inventorySummary;
        this.topProducts = topProducts;
        this.dailySales = dailySales;
        this.paymentMethods = paymentMethods;
        this.employeePerformance = employeePerformance;
    }

    public SalesSummary getSalesSummary() {
        return salesSummary;
    }

    public void setSalesSummary(SalesSummary salesSummary) {
        this.salesSummary = salesSummary;
    }

    public InventorySummary getInventorySummary() {
        return inventorySummary;
    }

    public void setInventorySummary(InventorySummary inventorySummary) {
        this.inventorySummary = inventorySummary;
    }

    public List<TopProduct> getTopProducts() {
        return topProducts;
    }

    public void setTopProducts(List<TopProduct> topProducts) {
        this.topProducts = topProducts;
    }

    public List<DailySales> getDailySales() {
        return dailySales;
    }

    public void setDailySales(List<DailySales> dailySales) {
        this.dailySales = dailySales;
    }

    public List<PaymentMethodData> getPaymentMethods() {
        return paymentMethods;
    }

    public void setPaymentMethods(List<PaymentMethodData> paymentMethods) {
        this.paymentMethods = paymentMethods;
    }

    public List<EmployeePerformanceData> getEmployeePerformance() {
        return employeePerformance;
    }

    public void setEmployeePerformance(List<EmployeePerformanceData> employeePerformance) {
        this.employeePerformance = employeePerformance;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DashboardResponse that = (DashboardResponse) o;
        return Objects.equals(salesSummary, that.salesSummary) && Objects.equals(inventorySummary, that.inventorySummary) && Objects.equals(topProducts, that.topProducts) && Objects.equals(dailySales, that.dailySales) && Objects.equals(paymentMethods, that.paymentMethods) && Objects.equals(employeePerformance, that.employeePerformance);
    }

    @Override
    public int hashCode() {
        return Objects.hash(salesSummary, inventorySummary, topProducts, dailySales, paymentMethods, employeePerformance);
    }

    @Override
    public String toString() {
        return "DashboardResponse{" +
                "salesSummary=" + salesSummary +
                ", inventorySummary=" + inventorySummary +
                ", topProducts=" + topProducts +
                ", dailySales=" + dailySales +
                ", paymentMethods=" + paymentMethods +
                ", employeePerformance=" + employeePerformance +
                '}';
    }

    public static class SalesSummary {
    private BigDecimal totalRevenue;
    private Long totalSales;
    private BigDecimal totalRefunds;
    private Long totalRefundCount;
    private Long totalItemsSold;

    public SalesSummary() {
    }

    public SalesSummary(BigDecimal totalRevenue, Long totalSales, BigDecimal totalRefunds, Long totalRefundCount, Long totalItemsSold) {
        this.totalRevenue = totalRevenue;
        this.totalSales = totalSales;
        this.totalRefunds = totalRefunds;
        this.totalRefundCount = totalRefundCount;
        this.totalItemsSold = totalItemsSold;
    }

    public BigDecimal getTotalRevenue() {
        return totalRevenue;
    }

    public void setTotalRevenue(BigDecimal totalRevenue) {
        this.totalRevenue = totalRevenue;
    }

    public Long getTotalSales() {
        return totalSales;
    }

    public void setTotalSales(Long totalSales) {
        this.totalSales = totalSales;
    }

    public BigDecimal getTotalRefunds() {
        return totalRefunds;
    }

    public void setTotalRefunds(BigDecimal totalRefunds) {
        this.totalRefunds = totalRefunds;
    }

    public Long getTotalRefundCount() {
        return totalRefundCount;
    }

    public void setTotalRefundCount(Long totalRefundCount) {
        this.totalRefundCount = totalRefundCount;
    }

    public Long getTotalItemsSold() {
        return totalItemsSold;
    }

    public void setTotalItemsSold(Long totalItemsSold) {
        this.totalItemsSold = totalItemsSold;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SalesSummary that = (SalesSummary) o;
        return Objects.equals(totalRevenue, that.totalRevenue) && Objects.equals(totalSales, that.totalSales) && Objects.equals(totalRefunds, that.totalRefunds) && Objects.equals(totalRefundCount, that.totalRefundCount) && Objects.equals(totalItemsSold, that.totalItemsSold);
    }

    @Override
    public int hashCode() {
        return Objects.hash(totalRevenue, totalSales, totalRefunds, totalRefundCount, totalItemsSold);
    }

    @Override
    public String toString() {
        return "SalesSummary{" +
                "totalRevenue=" + totalRevenue +
                ", totalSales=" + totalSales +
                ", totalRefunds=" + totalRefunds +
                ", totalRefundCount=" + totalRefundCount +
                ", totalItemsSold=" + totalItemsSold +
                '}';
    }
}

    public static class PaymentMethodData {
    private String paymentMethod;
    private Long count;

    public PaymentMethodData() {
    }

    public PaymentMethodData(String paymentMethod, Long count) {
        this.paymentMethod = paymentMethod;
        this.count = count;
    }

    public String getPaymentMethod() {
        return paymentMethod;
    }

    public void setPaymentMethod(String paymentMethod) {
        this.paymentMethod = paymentMethod;
    }

    public Long getCount() {
        return count;
    }

    public void setCount(Long count) {
        this.count = count;
    }
}

    public static class EmployeePerformanceData {
    private String employeeName;
    private BigDecimal revenue;

    public EmployeePerformanceData() {
    }

    public EmployeePerformanceData(String employeeName, BigDecimal revenue) {
        this.employeeName = employeeName;
        this.revenue = revenue;
    }

    public String getEmployeeName() {
        return employeeName;
    }

    public void setEmployeeName(String employeeName) {
        this.employeeName = employeeName;
    }

    public BigDecimal getRevenue() {
        return revenue;
    }

    public void setRevenue(BigDecimal revenue) {
        this.revenue = revenue;
    }
}

    public static class InventorySummary {
    private Long totalProducts;
    private Long lowStockProducts;
    private Long outOfStockProducts;

    public InventorySummary() {
    }

    public InventorySummary(Long totalProducts, Long lowStockProducts, Long outOfStockProducts) {
        this.totalProducts = totalProducts;
        this.lowStockProducts = lowStockProducts;
        this.outOfStockProducts = outOfStockProducts;
    }

    public Long getTotalProducts() {
        return totalProducts;
    }

    public void setTotalProducts(Long totalProducts) {
        this.totalProducts = totalProducts;
    }

    public Long getLowStockProducts() {
        return lowStockProducts;
    }

    public void setLowStockProducts(Long lowStockProducts) {
        this.lowStockProducts = lowStockProducts;
    }

    public Long getOutOfStockProducts() {
        return outOfStockProducts;
    }

    public void setOutOfStockProducts(Long outOfStockProducts) {
        this.outOfStockProducts = outOfStockProducts;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        InventorySummary that = (InventorySummary) o;
        return Objects.equals(totalProducts, that.totalProducts) && Objects.equals(lowStockProducts, that.lowStockProducts) && Objects.equals(outOfStockProducts, that.outOfStockProducts);
    }

    @Override
    public int hashCode() {
        return Objects.hash(totalProducts, lowStockProducts, outOfStockProducts);
    }

    @Override
    public String toString() {
        return "InventorySummary{" +
                "totalProducts=" + totalProducts +
                ", lowStockProducts=" + lowStockProducts +
                ", outOfStockProducts=" + outOfStockProducts +
                '}';
    }
}

    public static class TopProduct {
    private Long productId;
    private String productName;
    private Long quantitySold;
    private BigDecimal revenue;

    public TopProduct() {
    }

    public TopProduct(Long productId, String productName, Long quantitySold, BigDecimal revenue) {
        this.productId = productId;
        this.productName = productName;
        this.quantitySold = quantitySold;
        this.revenue = revenue;
    }

    public Long getProductId() {
        return productId;
    }

    public void setProductId(Long productId) {
        this.productId = productId;
    }

    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }

    public Long getQuantitySold() {
        return quantitySold;
    }

    public void setQuantitySold(Long quantitySold) {
        this.quantitySold = quantitySold;
    }

    public BigDecimal getRevenue() {
        return revenue;
    }

    public void setRevenue(BigDecimal revenue) {
        this.revenue = revenue;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        TopProduct that = (TopProduct) o;
        return Objects.equals(productId, that.productId) && Objects.equals(productName, that.productName) && Objects.equals(quantitySold, that.quantitySold) && Objects.equals(revenue, that.revenue);
    }

    @Override
    public int hashCode() {
        return Objects.hash(productId, productName, quantitySold, revenue);
    }

    @Override
    public String toString() {
        return "TopProduct{" +
                "productId=" + productId +
                ", productName='" + productName + '\'' +
                ", quantitySold=" + quantitySold +
                ", revenue=" + revenue +
                '}';
    }
}

    public static class DailySales {
    private String date;
    private BigDecimal revenue;
    private Long salesCount;

    public DailySales() {
    }

    public DailySales(String date, BigDecimal revenue, Long salesCount) {
        this.date = date;
        this.revenue = revenue;
        this.salesCount = salesCount;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public BigDecimal getRevenue() {
        return revenue;
    }

    public void setRevenue(BigDecimal revenue) {
        this.revenue = revenue;
    }

    public Long getSalesCount() {
        return salesCount;
    }

    public void setSalesCount(Long salesCount) {
        this.salesCount = salesCount;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DailySales that = (DailySales) o;
        return Objects.equals(date, that.date) && Objects.equals(revenue, that.revenue) && Objects.equals(salesCount, that.salesCount);
    }

    @Override
    public int hashCode() {
        return Objects.hash(date, revenue, salesCount);
    }

    @Override
    public String toString() {
        return "DailySales{" +
                "date='" + date + '\'' +
                ", revenue=" + revenue +
                ", salesCount=" + salesCount +
                '}';
    }
}
}
