use std::collections::BTreeSet;
use time::OffsetDateTime;
use crate::series::Series;
pub mod abgrenzung;
pub mod pauschal;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Gate<'a> {
Always,
Flagged(&'a BTreeSet<OffsetDateTime>),
}
impl Gate<'_> {
#[must_use]
pub fn passes(&self, at: OffsetDateTime) -> bool {
match self {
Self::Always => true,
Self::Flagged(set) => set.contains(&at),
}
}
}
#[derive(Debug, Clone, Copy)]
pub enum Einspeisung<'a> {
Z1(&'a Series),
Zw(&'a Series),
}
impl<'a> Einspeisung<'a> {
pub(crate) const fn series(self) -> &'a Series {
match self {
Self::Z1(s) | Self::Zw(s) => s,
}
}
pub(crate) const fn name(self) -> &'static str {
match self {
Self::Z1(_) => "Z1NE",
Self::Zw(_) => "ZWNE",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum Abgrenzungsfall {
A1,
A2,
A3,
A4,
A5,
A6,
A7,
A8,
A9,
A10,
A11,
}
impl Abgrenzungsfall {
pub const ALL: [Self; 11] = [
Self::A1,
Self::A2,
Self::A3,
Self::A4,
Self::A5,
Self::A6,
Self::A7,
Self::A8,
Self::A9,
Self::A10,
Self::A11,
];
#[must_use]
pub const fn as_str(self) -> &'static str {
match self {
Self::A1 => "A1",
Self::A2 => "A2",
Self::A3 => "A3",
Self::A4 => "A4",
Self::A5 => "A5",
Self::A6 => "A6",
Self::A7 => "A7",
Self::A8 => "A8",
Self::A9 => "A9",
Self::A10 => "A10",
Self::A11 => "A11",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[non_exhaustive]
pub enum Pauschalfall {
P1,
P2,
P3,
P4,
P5,
}
impl Pauschalfall {
pub const ALL: [Self; 5] = [Self::P1, Self::P2, Self::P3, Self::P4, Self::P5];
#[must_use]
pub const fn as_str(self) -> &'static str {
match self {
Self::P1 => "P1",
Self::P2 => "P2",
Self::P3 => "P3",
Self::P4 => "P4",
Self::P5 => "P5",
}
}
}
crate::ids::codes::string_codes! {
Abgrenzungsfall;
Pauschalfall;
}