use chrono_tz::America;
use crate::calendar::SessionRule;
use crate::calendar::rule::MON_FRI;
use crate::calendar::schedules::StaticHoursProfile;
use crate::calendar::schedules::timeline::{Revision, local_date, revisions, select_revision};
static LAUNCH_REGULAR: &[SessionRule] = &[SessionRule {
days: MON_FRI,
open_ssm: 7 * 3600,
close_ssm: 16 * 3600,
}];
static LAUNCH_ORDER_ENTRY: &[SessionRule] = &[SessionRule {
days: MON_FRI,
open_ssm: 6 * 3600 + 30 * 60,
close_ssm: 7 * 3600,
}];
static LAUNCH: StaticHoursProfile = StaticHoursProfile {
tz: America::Chicago,
regular: LAUNCH_REGULAR,
extended: &[],
order_entry: LAUNCH_ORDER_ENTRY,
has_daily_close: true,
has_weekend_close: true,
};
static S5C_REGULAR: &[SessionRule] = &[SessionRule {
days: MON_FRI,
open_ssm: 8 * 3600 + 30 * 60,
close_ssm: 15 * 3600,
}];
static S5C_ORDER_ENTRY: &[SessionRule] = &[SessionRule {
days: MON_FRI,
open_ssm: 8 * 3600,
close_ssm: 8 * 3600 + 30 * 60,
}];
static S5C_ERA: StaticHoursProfile = StaticHoursProfile {
tz: America::Chicago,
regular: S5C_REGULAR,
extended: &[],
order_entry: S5C_ORDER_ENTRY,
has_daily_close: true,
has_weekend_close: true,
};
static CLOSED: StaticHoursProfile = StaticHoursProfile {
tz: America::Chicago,
regular: &[],
extended: &[],
order_entry: &[],
has_daily_close: true,
has_weekend_close: true,
};
static REVISIONS: &[Revision] = revisions![
(
2020,
5,
18,
&LAUNCH,
"SMFE 2020-003..005 launch certifications"
),
(
2024,
11,
4,
&S5C_ERA,
"SMFE info hub, last 07:00-16:00 capture 2024-11-03, keyed to the Monday; SMFE 2024-010"
),
(2025, 3, 24, &CLOSED, "SMFE 2025-001 delisting"),
];
pub(crate) fn profile_at(as_of: chrono::DateTime<chrono::Utc>) -> &'static StaticHoursProfile {
select_revision(local_date(as_of, America::Chicago), &CLOSED, REVISIONS)
}