···11+use crate::loose_enum;
22+use crate::macros::LooseBool;
33+use serde::{Deserialize, Serialize};
44+55+/// Controls which light indices are affected by event boxes.
66+#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
77+#[serde(rename_all = "camelCase")]
88+pub struct Filter {
99+ // V3
1010+ #[serde(rename = "f")]
1111+ pub filter_type: FilterType,
1212+ /// Dependent on the [`FilterType`]
1313+ #[serde(rename = "p")]
1414+ pub parameter1: i32,
1515+ /// Dependent on the [`FilterType`]
1616+ #[serde(rename = "t")]
1717+ pub parameter2: i32,
1818+ #[serde(rename = "r")]
1919+ pub reverse: LooseBool,
2020+ // V3.1
2121+ #[serde(rename = "c")]
2222+ pub chunks: i32,
2323+ #[serde(rename = "n")]
2424+ pub random_behaviour: i32,
2525+ #[serde(rename = "s")]
2626+ pub random_seed: i32,
2727+ #[serde(rename = "d")]
2828+ pub limit_behaviour: i32,
2929+ #[serde(rename = "l")]
3030+ pub limit_percent: i32,
3131+}
3232+3333+loose_enum! {
3434+ /// The parameters of a [Filter] do different things depending on the type.
3535+ ///
3636+ /// ### [Division](https://bsmg.wiki/mapping/map-format/lightshow.html#index-filters-type-1):
3737+ /// Splits the group up into equal sections and selects one.
3838+ /// - Parameter 1 determines the number of sections.
3939+ /// It will be rounded up to the nearest multiple of the group size.
4040+ /// - Parameter 2 determines the section to select, starting at 0.
4141+ ///
4242+ /// ### [Step and Offset](https://bsmg.wiki/mapping/map-format/lightshow.html#index-filters-type-2):
4343+ /// Alternates selecting and not selecting lights.
4444+ /// - Parameter 1 is the index of the first light that will be selected, starting at 0.
4545+ /// - Parameter 2 determines the number of lights that will be skipped between selections.
4646+ #[derive(Default)]
4747+ FilterType {
4848+ #[default]
4949+ //Todo Doesn't match wiki
5050+ Division = 1,
5151+ StepAndOffset = 2,
5252+ }
5353+}