part of '../analytic.dart';

@freezed
class PaymentMethodAnalytic with _$PaymentMethodAnalytic {
  const factory PaymentMethodAnalytic({
    required String organizationId,
    required String outletId,
    required String outletName,
    required String dateFrom,
    required String dateTo,
    required String groupBy,
    required PaymentMethodSummary summary,
    required List<PaymentMethodItem> data,
  }) = _PaymentMethodAnalytic;

  factory PaymentMethodAnalytic.empty() => PaymentMethodAnalytic(
    organizationId: '',
    outletId: '',
    outletName: '',
    dateFrom: '',
    dateTo: '',
    groupBy: '',
    summary: PaymentMethodSummary.empty(),
    data: [],
  );
}

@freezed
class PaymentMethodItem with _$PaymentMethodItem {
  const factory PaymentMethodItem({
    required String paymentMethodId,
    required String paymentMethodName,
    required String paymentMethodType,
    required num totalAmount,
    required int orderCount,
    required int paymentCount,
    required double percentage,
  }) = _PaymentMethodItem;

  factory PaymentMethodItem.empty() => const PaymentMethodItem(
    paymentMethodId: '',
    paymentMethodName: '',
    paymentMethodType: '',
    totalAmount: 0,
    orderCount: 0,
    paymentCount: 0,
    percentage: 0.0,
  );
}

@freezed
class PaymentMethodSummary with _$PaymentMethodSummary {
  const factory PaymentMethodSummary({
    required num totalAmount,
    required int totalOrders,
    required int totalPayments,
    required double averageOrderValue,
  }) = _PaymentMethodSummary;

  factory PaymentMethodSummary.empty() => const PaymentMethodSummary(
    totalAmount: 0,
    totalOrders: 0,
    totalPayments: 0,
    averageOrderValue: 0.0,
  );
}
