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

pub(super) fn fill_selected_company_dividend_policy_fields(
    fields: &mut SelectedCompanySummaryFields,
    inputs: &SelectedCompanyInputs<'_>,
) {
    fields.selected_company_dividend_weighted_recent_net_profit_total = inputs
        .dividend_state
        .as_ref()
        .and_then(|dividend_state| dividend_state.weighted_recent_net_profit_total);
    fields.selected_company_dividend_weighted_recent_net_profit_average = inputs
        .dividend_state
        .as_ref()
        .and_then(|dividend_state| dividend_state.weighted_recent_net_profit_average);
    fields.selected_company_dividend_current_cash = inputs
        .dividend_state
        .as_ref()
        .and_then(|dividend_state| dividend_state.current_cash);
    fields.selected_company_dividend_tiny_unassigned_share_cash_supplement_branch = inputs
        .dividend_state
        .as_ref()
        .map(|dividend_state| dividend_state.tiny_unassigned_share_cash_supplement_branch);
    fields.selected_company_dividend_tentative_target_per_share_tenths = inputs
        .dividend_state
        .as_ref()
        .and_then(|dividend_state| dividend_state.tentative_target_dividend_per_share_tenths);
    fields.selected_company_dividend_current_per_share_tenths = inputs
        .dividend_state
        .as_ref()
        .and_then(|dividend_state| dividend_state.current_dividend_per_share_tenths);
    fields.selected_company_dividend_growth_adjusted_current_per_share_tenths =
        inputs.dividend_state.as_ref().and_then(|dividend_state| {
            dividend_state.growth_adjusted_current_dividend_per_share_tenths
        });
    fields.selected_company_dividend_board_approved_ceiling_tenths = inputs
        .dividend_state
        .as_ref()
        .and_then(|dividend_state| dividend_state.board_approved_dividend_rate_ceiling_tenths);
    fields.selected_company_dividend_proposed_per_share_tenths = inputs
        .dividend_state
        .as_ref()
        .and_then(|dividend_state| dividend_state.proposed_dividend_per_share_tenths);
    fields.selected_company_dividend_eligible_for_adjustment_branch = inputs
        .dividend_state
        .as_ref()
        .map(|dividend_state| dividend_state.eligible_for_dividend_adjustment_branch);
}
