use rrt_runtime::summary::RuntimeSummary;

use crate::schema::ExpectedRuntimeSummary;

pub(super) fn compare_packed_events(
    expected: &ExpectedRuntimeSummary,
    actual: &RuntimeSummary,
    mismatches: &mut Vec<String>,
) {
    if let Some(present) = expected.packed_event_collection_present {
        if actual.packed_event_collection_present != present {
            mismatches.push(format!(
                "packed_event_collection_present mismatch: expected {present}, got {}",
                actual.packed_event_collection_present
            ));
        }
    }
    if let Some(count) = expected.packed_event_record_count {
        if actual.packed_event_record_count != count {
            mismatches.push(format!(
                "packed_event_record_count mismatch: expected {count}, got {}",
                actual.packed_event_record_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_decoded_record_count {
        if actual.packed_event_decoded_record_count != count {
            mismatches.push(format!(
                "packed_event_decoded_record_count mismatch: expected {count}, got {}",
                actual.packed_event_decoded_record_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_imported_runtime_record_count {
        if actual.packed_event_imported_runtime_record_count != count {
            mismatches.push(format!(
                "packed_event_imported_runtime_record_count mismatch: expected {count}, got {}",
                actual.packed_event_imported_runtime_record_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_parity_only_record_count {
        if actual.packed_event_parity_only_record_count != count {
            mismatches.push(format!(
                "packed_event_parity_only_record_count mismatch: expected {count}, got {}",
                actual.packed_event_parity_only_record_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_unsupported_record_count {
        if actual.packed_event_unsupported_record_count != count {
            mismatches.push(format!(
                "packed_event_unsupported_record_count mismatch: expected {count}, got {}",
                actual.packed_event_unsupported_record_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_missing_company_context_count {
        if actual.packed_event_blocked_missing_company_context_count != count {
            mismatches.push(format!(
                "packed_event_blocked_missing_company_context_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_missing_company_context_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_missing_selection_context_count {
        if actual.packed_event_blocked_missing_selection_context_count != count {
            mismatches.push(format!(
                "packed_event_blocked_missing_selection_context_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_missing_selection_context_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_missing_company_role_context_count {
        if actual.packed_event_blocked_missing_company_role_context_count != count {
            mismatches.push(format!(
                "packed_event_blocked_missing_company_role_context_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_missing_company_role_context_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_missing_player_context_count {
        if actual.packed_event_blocked_missing_player_context_count != count {
            mismatches.push(format!(
                "packed_event_blocked_missing_player_context_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_missing_player_context_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_missing_player_selection_context_count {
        if actual.packed_event_blocked_missing_player_selection_context_count != count {
            mismatches.push(format!(
                "packed_event_blocked_missing_player_selection_context_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_missing_player_selection_context_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_missing_player_role_context_count {
        if actual.packed_event_blocked_missing_player_role_context_count != count {
            mismatches.push(format!(
                "packed_event_blocked_missing_player_role_context_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_missing_player_role_context_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_missing_chairman_context_count {
        if actual.packed_event_blocked_missing_chairman_context_count != count {
            mismatches.push(format!(
                "packed_event_blocked_missing_chairman_context_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_missing_chairman_context_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_chairman_target_scope_count {
        if actual.packed_event_blocked_chairman_target_scope_count != count {
            mismatches.push(format!(
                "packed_event_blocked_chairman_target_scope_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_chairman_target_scope_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_missing_condition_context_count {
        if actual.packed_event_blocked_missing_condition_context_count != count {
            mismatches.push(format!(
                "packed_event_blocked_missing_condition_context_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_missing_condition_context_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_missing_player_condition_context_count {
        if actual.packed_event_blocked_missing_player_condition_context_count != count {
            mismatches.push(format!(
                "packed_event_blocked_missing_player_condition_context_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_missing_player_condition_context_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_company_condition_scope_disabled_count {
        if actual.packed_event_blocked_company_condition_scope_disabled_count != count {
            mismatches.push(format!(
                "packed_event_blocked_company_condition_scope_disabled_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_company_condition_scope_disabled_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_player_condition_scope_count {
        if actual.packed_event_blocked_player_condition_scope_count != count {
            mismatches.push(format!(
                "packed_event_blocked_player_condition_scope_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_player_condition_scope_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_territory_condition_scope_count {
        if actual.packed_event_blocked_territory_condition_scope_count != count {
            mismatches.push(format!(
                "packed_event_blocked_territory_condition_scope_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_territory_condition_scope_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_missing_territory_context_count {
        if actual.packed_event_blocked_missing_territory_context_count != count {
            mismatches.push(format!(
                "packed_event_blocked_missing_territory_context_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_missing_territory_context_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_named_territory_binding_count {
        if actual.packed_event_blocked_named_territory_binding_count != count {
            mismatches.push(format!(
                "packed_event_blocked_named_territory_binding_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_named_territory_binding_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_unmapped_ordinary_condition_count {
        if actual.packed_event_blocked_unmapped_ordinary_condition_count != count {
            mismatches.push(format!(
                "packed_event_blocked_unmapped_ordinary_condition_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_unmapped_ordinary_condition_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_unmapped_world_condition_count {
        if actual.packed_event_blocked_unmapped_world_condition_count != count {
            mismatches.push(format!(
                "packed_event_blocked_unmapped_world_condition_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_unmapped_world_condition_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_missing_compact_control_count {
        if actual.packed_event_blocked_missing_compact_control_count != count {
            mismatches.push(format!(
                "packed_event_blocked_missing_compact_control_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_missing_compact_control_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_shell_owned_descriptor_count {
        if actual.packed_event_blocked_shell_owned_descriptor_count != count {
            mismatches.push(format!(
                "packed_event_blocked_shell_owned_descriptor_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_shell_owned_descriptor_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_evidence_blocked_descriptor_count {
        if actual.packed_event_blocked_evidence_blocked_descriptor_count != count {
            mismatches.push(format!(
                "packed_event_blocked_evidence_blocked_descriptor_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_evidence_blocked_descriptor_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_variant_or_scope_blocked_descriptor_count {
        if actual.packed_event_blocked_variant_or_scope_blocked_descriptor_count != count {
            mismatches.push(format!(
                "packed_event_blocked_variant_or_scope_blocked_descriptor_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_variant_or_scope_blocked_descriptor_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_unmapped_real_descriptor_count {
        if actual.packed_event_blocked_unmapped_real_descriptor_count != count {
            mismatches.push(format!(
                "packed_event_blocked_unmapped_real_descriptor_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_unmapped_real_descriptor_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_unmapped_world_descriptor_count {
        if actual.packed_event_blocked_unmapped_world_descriptor_count != count {
            mismatches.push(format!(
                "packed_event_blocked_unmapped_world_descriptor_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_unmapped_world_descriptor_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_territory_access_variant_count {
        if actual.packed_event_blocked_territory_access_variant_count != count {
            mismatches.push(format!(
                "packed_event_blocked_territory_access_variant_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_territory_access_variant_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_territory_access_scope_count {
        if actual.packed_event_blocked_territory_access_scope_count != count {
            mismatches.push(format!(
                "packed_event_blocked_territory_access_scope_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_territory_access_scope_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_missing_train_context_count {
        if actual.packed_event_blocked_missing_train_context_count != count {
            mismatches.push(format!(
                "packed_event_blocked_missing_train_context_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_missing_train_context_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_missing_train_territory_context_count {
        if actual.packed_event_blocked_missing_train_territory_context_count != count {
            mismatches.push(format!(
                "packed_event_blocked_missing_train_territory_context_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_missing_train_territory_context_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_missing_locomotive_catalog_context_count {
        if actual.packed_event_blocked_missing_locomotive_catalog_context_count != count {
            mismatches.push(format!(
                "packed_event_blocked_missing_locomotive_catalog_context_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_missing_locomotive_catalog_context_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_confiscation_variant_count {
        if actual.packed_event_blocked_confiscation_variant_count != count {
            mismatches.push(format!(
                "packed_event_blocked_confiscation_variant_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_confiscation_variant_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_retire_train_variant_count {
        if actual.packed_event_blocked_retire_train_variant_count != count {
            mismatches.push(format!(
                "packed_event_blocked_retire_train_variant_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_retire_train_variant_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_retire_train_scope_count {
        if actual.packed_event_blocked_retire_train_scope_count != count {
            mismatches.push(format!(
                "packed_event_blocked_retire_train_scope_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_retire_train_scope_count
            ));
        }
    }
    if let Some(count) = expected.packed_event_blocked_structural_only_count {
        if actual.packed_event_blocked_structural_only_count != count {
            mismatches.push(format!(
                "packed_event_blocked_structural_only_count mismatch: expected {count}, got {}",
                actual.packed_event_blocked_structural_only_count
            ));
        }
    }
}
