use rrt_runtime::summary::RuntimeSummary;

use crate::schema::ExpectedRuntimeSummary;

pub(super) fn compare_selected_company(
    expected: &ExpectedRuntimeSummary,
    actual: &RuntimeSummary,
    mismatches: &mut Vec<String>,
) {
    if let Some(value) = expected.selected_company_outstanding_shares {
        if actual.selected_company_outstanding_shares != Some(value) {
            mismatches.push(format!(
                "selected_company_outstanding_shares mismatch: expected {value}, got {:?}",
                actual.selected_company_outstanding_shares
            ));
        }
    }
    if let Some(value) = expected.selected_company_bond_count {
        if actual.selected_company_bond_count != Some(value) {
            mismatches.push(format!(
                "selected_company_bond_count mismatch: expected {value}, got {:?}",
                actual.selected_company_bond_count
            ));
        }
    }
    if let Some(value) = expected.selected_company_largest_live_bond_principal {
        if actual.selected_company_largest_live_bond_principal != Some(value) {
            mismatches.push(format!(
                "selected_company_largest_live_bond_principal mismatch: expected {value}, got {:?}",
                actual.selected_company_largest_live_bond_principal
            ));
        }
    }
    if let Some(value) = expected.selected_company_highest_coupon_live_bond_principal {
        if actual.selected_company_highest_coupon_live_bond_principal != Some(value) {
            mismatches.push(format!(
                "selected_company_highest_coupon_live_bond_principal mismatch: expected {value}, got {:?}",
                actual.selected_company_highest_coupon_live_bond_principal
            ));
        }
    }
    if let Some(value) = expected.selected_company_assigned_share_pool {
        if actual.selected_company_assigned_share_pool != Some(value) {
            mismatches.push(format!(
                "selected_company_assigned_share_pool mismatch: expected {value}, got {:?}",
                actual.selected_company_assigned_share_pool
            ));
        }
    }
    if let Some(value) = expected.selected_company_unassigned_share_pool {
        if actual.selected_company_unassigned_share_pool != Some(value) {
            mismatches.push(format!(
                "selected_company_unassigned_share_pool mismatch: expected {value}, got {:?}",
                actual.selected_company_unassigned_share_pool
            ));
        }
    }
    if let Some(value) = expected.selected_company_cached_share_price {
        if actual.selected_company_cached_share_price != Some(value) {
            mismatches.push(format!(
                "selected_company_cached_share_price mismatch: expected {value}, got {:?}",
                actual.selected_company_cached_share_price
            ));
        }
    }
    if let Some(value) = &expected.selected_company_cached_share_price_value_f32_text {
        if actual
            .selected_company_cached_share_price_value_f32_text
            .as_ref()
            != Some(value)
        {
            mismatches.push(format!(
                "selected_company_cached_share_price_value_f32_text mismatch: expected {value:?}, got {:?}",
                actual.selected_company_cached_share_price_value_f32_text
            ));
        }
    }
    if let Some(value) = &expected.selected_company_mutable_support_scalar_value_f32_text {
        if actual
            .selected_company_mutable_support_scalar_value_f32_text
            .as_ref()
            != Some(value)
        {
            mismatches.push(format!(
                "selected_company_mutable_support_scalar_value_f32_text mismatch: expected {value:?}, got {:?}",
                actual.selected_company_mutable_support_scalar_value_f32_text
            ));
        }
    }
    if let Some(count) = expected.selected_company_stat_band_root_0cfb_count {
        if actual.selected_company_stat_band_root_0cfb_count != count {
            mismatches.push(format!(
                "selected_company_stat_band_root_0cfb_count mismatch: expected {count}, got {}",
                actual.selected_company_stat_band_root_0cfb_count
            ));
        }
    }
    if let Some(count) = expected.selected_company_stat_band_root_0d7f_count {
        if actual.selected_company_stat_band_root_0d7f_count != count {
            mismatches.push(format!(
                "selected_company_stat_band_root_0d7f_count mismatch: expected {count}, got {}",
                actual.selected_company_stat_band_root_0d7f_count
            ));
        }
    }
    if let Some(count) = expected.selected_company_stat_band_root_1c47_count {
        if actual.selected_company_stat_band_root_1c47_count != count {
            mismatches.push(format!(
                "selected_company_stat_band_root_1c47_count mismatch: expected {count}, got {}",
                actual.selected_company_stat_band_root_1c47_count
            ));
        }
    }
    if let Some(value) = expected.selected_company_last_dividend_year {
        if actual.selected_company_last_dividend_year != Some(value) {
            mismatches.push(format!(
                "selected_company_last_dividend_year mismatch: expected {value}, got {:?}",
                actual.selected_company_last_dividend_year
            ));
        }
    }
    if let Some(value) = expected.selected_company_years_since_founding {
        if actual.selected_company_years_since_founding != Some(value) {
            mismatches.push(format!(
                "selected_company_years_since_founding mismatch: expected {value}, got {:?}",
                actual.selected_company_years_since_founding
            ));
        }
    }
    if let Some(value) = expected.selected_company_years_since_last_bankruptcy {
        if actual.selected_company_years_since_last_bankruptcy != Some(value) {
            mismatches.push(format!(
                "selected_company_years_since_last_bankruptcy mismatch: expected {value}, got {:?}",
                actual.selected_company_years_since_last_bankruptcy
            ));
        }
    }
    if let Some(value) = expected.selected_company_years_since_last_dividend {
        if actual.selected_company_years_since_last_dividend != Some(value) {
            mismatches.push(format!(
                "selected_company_years_since_last_dividend mismatch: expected {value}, got {:?}",
                actual.selected_company_years_since_last_dividend
            ));
        }
    }
    if let Some(value) = expected.selected_company_current_partial_year_weight_numerator {
        if actual.selected_company_current_partial_year_weight_numerator != Some(value) {
            mismatches.push(format!(
                "selected_company_current_partial_year_weight_numerator mismatch: expected {value}, got {:?}",
                actual.selected_company_current_partial_year_weight_numerator
            ));
        }
    }
    if let Some(value) = expected.selected_company_current_issue_absolute_counter {
        if actual.selected_company_current_issue_absolute_counter != Some(value) {
            mismatches.push(format!(
                "selected_company_current_issue_absolute_counter mismatch: expected {value}, got {:?}",
                actual.selected_company_current_issue_absolute_counter
            ));
        }
    }
    if let Some(value) = expected.selected_company_prior_issue_absolute_counter {
        if actual.selected_company_prior_issue_absolute_counter != Some(value) {
            mismatches.push(format!(
                "selected_company_prior_issue_absolute_counter mismatch: expected {value}, got {:?}",
                actual.selected_company_prior_issue_absolute_counter
            ));
        }
    }
    if let Some(value) = expected.selected_company_current_issue_age_absolute_counter_delta {
        if actual.selected_company_current_issue_age_absolute_counter_delta != Some(value) {
            mismatches.push(format!(
                "selected_company_current_issue_age_absolute_counter_delta mismatch: expected {value}, got {:?}",
                actual.selected_company_current_issue_age_absolute_counter_delta
            ));
        }
    }
    if let Some(value) = expected.selected_company_chairman_bonus_year {
        if actual.selected_company_chairman_bonus_year != Some(value) {
            mismatches.push(format!(
                "selected_company_chairman_bonus_year mismatch: expected {value}, got {:?}",
                actual.selected_company_chairman_bonus_year
            ));
        }
    }
    if let Some(value) = expected.selected_company_chairman_bonus_amount {
        if actual.selected_company_chairman_bonus_amount != Some(value) {
            mismatches.push(format!(
                "selected_company_chairman_bonus_amount mismatch: expected {value}, got {:?}",
                actual.selected_company_chairman_bonus_amount
            ));
        }
    }
}
