import 'package:flux/features/master_data/providers/models/provider_model.dart';
import 'package:flux/features/master_data/providers/models/provider_role.dart';

extension ProviderCompatibility on ProviderModel {
  bool supportsOperation(String operationType) {
    if (operationType == 'Altro') return true;

    switch (operationType) {
      case 'AL' || 'MNP':
        return roles.contains(ProviderRole.mobile);
      case 'NIP' || 'FWA':
        return roles.contains(ProviderRole.landline);
      case 'UNICA':
        return roles.contains(ProviderRole.landline) ||
            roles.contains(ProviderRole.mobile);
      case 'Energy':
        return roles.contains(ProviderRole.energy);
      case 'Fin':
        return roles.contains(ProviderRole.financing);
      case 'Entertainment':
        return roles.contains(ProviderRole.entertainment);
      case 'TELEPASS':
        return roles.contains(ProviderRole.telepass);
      default:
        return true;
    }
  }
}
