use super::model::WorldSummaryFields;
use crate::RuntimeState;

pub(super) fn fill_world_overview_fields(fields: &mut WorldSummaryFields, state: &RuntimeState) {
    fields.calendar_projection_source = state.metadata.get("save_slice.calendar_source").cloned();
    fields.calendar_projection_is_placeholder = state
        .metadata
        .get("save_slice.calendar_source")
        .is_some_and(|value| value == "default-1830-placeholder");
    fields.world_flag_count = state.world_flags.len();
    fields.metadata_count = state.metadata.len();
    fields.company_count = state.companies.len();
    fields.active_company_count = state
        .companies
        .iter()
        .filter(|company| company.active)
        .count();
    fields.company_market_state_owner_count = state.service_state.company_market_state.len();
}
