// BoardSegmentState.swift // Lyrebird // // Copyright (c) 2026 Joshua Parmenter / realizedsound // SPDX-License-Identifier: MIT /// Serialisable snapshot of one ordered element of a board's signal chain. /// /// A board's full topology is a `[BoardSegmentState]` in signal-flow order: a sequence of /// linear pedals interleaved with parallel and stereo split regions. This is the unit that /// makes split-region topology round-trip through presets, where the older flat /// `[PedalState]` list could not. /// /// `Codable` conformance is auto-synthesized for this associated-value enum. /// /// > Important: The synthesized encoding uses the case names — `"pedal"`, `"parallel"`, /// > `"stereoSplit"` — as the on-disk discriminators. Renaming a case is a wire-format break /// > that would prevent older presets from decoding; rename only with a migration. public enum BoardSegmentState: Codable, Equatable { /// A single linear pedal. Wire discriminator: `"pedal"`. case pedal(PedalState) /// A parallel section (`split()`/`merge()`). Wire discriminator: `"parallel"`. case parallel(ParallelSectionState) /// A stereo split region (`splitStereo()`/`collectStereo()`). Wire discriminator: `"stereoSplit"`. case stereoSplit(StereoSplitState) /// A stereo unzip region (`unzipStereo()`/`collectStereo()`). Wire discriminator: `"stereoUnzip"`. case stereoUnzip(StereoUnzipState) /// A `mergeToMono()` collapse (no payload). Wire discriminator: `"mergeToMono"`. case mergeToMono }