// RigArchive.swift // Lyrebird // // Copyright (c) 2026 Joshua Parmenter / realizedsound // SPDX-License-Identifier: MIT import Foundation /// Format version written into every exported ``RigArchive``. /// /// Increment when the archive schema changes in a way that requires migration on load. public let rigArchiveFormatVersion: Int = 1 /// A portable bundle of one or more ``RigEntry`` rigs in a single JSON document. /// /// `RigArchive` is the hand-editable, shareable file format used by the library's /// **Export Archive** / **Import Archive** actions — the way to back up or move an entire /// collection of rigs as one file. It is the multi-rig successor to the old single-rig file /// save/load: a legacy single-rig file (a bare ``ShoeGazeState``) is still importable and is /// treated as a one-rig archive (see `RigLibraryStore.importArchive`). /// /// The document is written pretty-printed with sorted keys, so it stays readable and editable by /// hand. `Date` values inside each ``RigEntry`` are encoded as `secondsSince1970`. public struct RigArchive: Codable, Equatable { /// Archive format version. Written as `rigArchiveFormatVersion` at export time. public let version: Int /// The rigs contained in this archive, in listing order. public let rigs: [RigEntry] /// Creates a rig archive. /// /// - Parameters: /// - version: Archive format version. Defaults to `rigArchiveFormatVersion`. /// - rigs: The rigs to bundle. public init( version: Int = rigArchiveFormatVersion, rigs: [RigEntry] ) { self.version = version self.rigs = rigs } }