part of '../product.dart';

@freezed
class ListProduct with _$ListProduct {
  const factory ListProduct({
    required List<Product> products,
    required int totalCount,
    required int page,
    required int limit,
    required int totalPages,
  }) = _ListProduct;

  factory ListProduct.empty() => const ListProduct(
    products: [],
    totalCount: 0,
    page: 0,
    limit: 0,
    totalPages: 0,
  );
}

@freezed
class Product with _$Product {
  const factory Product({
    required String id,
    required String organizationId,
    required String categoryId,
    required String sku,
    required String name,
    required String description,
    required double price,
    required double cost,
    required String businessType,
    required String imageUrl,
    required String printerType,
    required bool printToChecker,
    required Map<String, dynamic> metadata,
    required bool isActive,
    required String createdAt,
    required String updatedAt,
    required List<ProductVariant> variants,
  }) = _Product;

  factory Product.empty() => const Product(
    id: '',
    organizationId: '',
    categoryId: '',
    sku: '',
    name: '',
    description: '',
    price: 0.0,
    cost: 0.0,
    businessType: '',
    imageUrl: '',
    printerType: '',
    printToChecker: false,
    metadata: {},
    isActive: false,
    createdAt: '',
    updatedAt: '',
    variants: [],
  );
}

@freezed
class ProductVariant with _$ProductVariant {
  const factory ProductVariant({
    required String id,
    required String productId,
    required String name,
    required double priceModifier,
    required double cost,
    required Map<String, dynamic> metadata,
    required String createdAt,
    required String updatedAt,
  }) = _ProductVariant;

  factory ProductVariant.empty() => const ProductVariant(
    id: '',
    productId: '',
    name: '',
    priceModifier: 0.0,
    cost: 0.0,
    metadata: {},
    createdAt: '',
    updatedAt: '',
  );
}
