part of 'product_cubit.dart';

enum ProductStatus { initial, loading, success, error }

class ProductState extends Equatable {
  final ProductStatus status;
  final List<BrandModel> brands;
  final List<ModelModel> models;
  final BrandModel? selectedBrand; // Il brand attualmente selezionato
  final String? errorMessage;

  const ProductState({
    this.status = ProductStatus.initial,
    this.brands = const [],
    this.models = const [],
    this.selectedBrand,
    this.errorMessage,
  });

  ProductState copyWith({
    ProductStatus? status,
    List<BrandModel>? brands,
    List<ModelModel>? models,
    BrandModel? selectedBrand,
    String? errorMessage,
  }) {
    return ProductState(
      status: status ?? this.status,
      brands: brands ?? this.brands,
      models: models ?? this.models,
      selectedBrand: selectedBrand ?? this.selectedBrand,
      errorMessage: errorMessage ?? this.errorMessage,
    );
  }

  @override
  List<Object?> get props => [
    status,
    brands,
    models,
    selectedBrand,
    errorMessage,
  ];
}
