use super::inputs::SelectedCompanyInputs;
use super::model::SelectedCompanySummaryFields;

pub(super) fn fill_selected_company_bond_policy_fields(
    fields: &mut SelectedCompanySummaryFields,
    inputs: &SelectedCompanyInputs<'_>,
) {
    fields.selected_company_annual_bond_linked_transit_latch = inputs
        .annual_bond_state
        .as_ref()
        .map(|bond_state| bond_state.linked_transit_latch);
    fields.selected_company_annual_bond_live_bond_count = inputs
        .annual_bond_state
        .as_ref()
        .and_then(|bond_state| bond_state.live_bond_count);
    fields.selected_company_annual_bond_live_bond_principal_total = inputs
        .annual_bond_state
        .as_ref()
        .and_then(|bond_state| bond_state.live_bond_principal_total);
    fields.selected_company_annual_bond_matured_live_bond_count = inputs
        .annual_bond_state
        .as_ref()
        .and_then(|bond_state| bond_state.matured_live_bond_count);
    fields.selected_company_annual_bond_matured_live_bond_principal_total = inputs
        .annual_bond_state
        .as_ref()
        .and_then(|bond_state| bond_state.matured_live_bond_principal_total);
    fields.selected_company_annual_bond_next_live_bond_maturity_year = inputs
        .annual_bond_state
        .as_ref()
        .and_then(|bond_state| bond_state.next_live_bond_maturity_year);
    fields.selected_company_annual_bond_live_bond_coupon_burden_total = inputs
        .annual_bond_state
        .as_ref()
        .and_then(|bond_state| bond_state.live_bond_coupon_burden_total);
    fields.selected_company_annual_bond_current_cash = inputs
        .annual_bond_state
        .as_ref()
        .and_then(|bond_state| bond_state.current_cash);
    fields.selected_company_annual_bond_cash_after_full_repayment = inputs
        .annual_bond_state
        .as_ref()
        .and_then(|bond_state| bond_state.cash_after_full_repayment);
    fields.selected_company_annual_bond_issue_cash_floor = inputs
        .annual_bond_state
        .as_ref()
        .and_then(|bond_state| bond_state.issue_cash_floor);
    fields.selected_company_annual_bond_issue_principal_step = inputs
        .annual_bond_state
        .as_ref()
        .and_then(|bond_state| bond_state.issue_principal_step);
    fields.selected_company_annual_bond_proposed_issue_bond_count = inputs
        .annual_bond_state
        .as_ref()
        .and_then(|bond_state| bond_state.proposed_issue_bond_count);
    fields.selected_company_annual_bond_proposed_issue_total_principal = inputs
        .annual_bond_state
        .as_ref()
        .and_then(|bond_state| bond_state.proposed_issue_total_principal);
    fields.selected_company_annual_bond_proposed_issue_years_to_maturity = inputs
        .annual_bond_state
        .as_ref()
        .and_then(|bond_state| bond_state.proposed_issue_years_to_maturity);
    fields.selected_company_annual_bond_eligible_for_issue_branch = inputs
        .annual_bond_state
        .as_ref()
        .map(|bond_state| bond_state.eligible_for_bond_issue_branch);
}
