moodlit-native/Sources/Core/Domain/Mood.swift
till bbfdff7e3c μ-7.0: Initial moodlit-native Skelett (Pure-Native iOS+macOS)
Pure-Native SwiftUI-App für Moodlit. Pendant zur SvelteKit-Web-App
auf moodlit.mana.how; konsumiert ManaCore + ManaTokens + ManaAuthUI
aus den Schwester-Repos.

Stack:
- SwiftUI Universal (iOS 18 / macOS 15), Swift 6 strict concurrency
- mana-swift-core + mana-swift-ui (lokale SPM-Pakete via XcodeGen)
- Bundle ev.mana.moodlit, Team QP3GLU8PH3, App-Group group.ev.mana.moodlit

Features:
- 24 Mood-Presets als Swift-Konstanten (Port von default-moods.ts)
- Custom-Moods + Sequenzen via MoodlitAPI (Actor mit JWT-Bearer-Calls
  über AuthenticatedTransport, automatischer 401-Retry)
- MoodPlayerView mit Idle-Timer-Off, Status-Bar-Hidden, Timer-Auto-
  Close, Favorite-Toggle, Play/Pause, Auto-Hide-Controls
- SequencePlayerView mit Crossfade-Rotation durch alle Sequence-Moods
  (Net new ggü. Web — dort ist Sequence-Playback nicht verkabelt)
- AnimatedMoodView rendert alle 21 AnimationTypes als 30-fps Timeline-
  View mit sin/cos-modulierten Filter-Effekten
- Cards-Pattern Auth-Gate: Presets ohne Login sichtbar, Custom-
  Creation triggert ManaAuthGate.require → Login-Sheet
- Theme: ManaTheme.twilight Forward (Violett #7c3aed)

Build verified:
- xcodebuild iOS Simulator (iPhone 17) → BUILD SUCCEEDED
- xcodebuild macOS → BUILD SUCCEEDED

Offen (μ-7.1+): Apple-Dev-Portal-Setup (Bundle, Capabilities), TestFlight,
Widget, Settings-UI (Brightness/Speed), Hex-Color-Picker mit Text-Input,
Visual-Polish der per-Animation Effekte.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 15:01:04 +02:00

64 lines
1.7 KiB
Swift

import Foundation
/// Moodlit-Wire-Type entspricht 1:1 dem TypeScript-Mood in
/// `Code/moodlit/packages/moodlit-domain/src/types.ts`.
///
/// Preset-Moods kommen aus `DefaultMoods.swift` (statisch im Bundle),
/// Custom-Moods aus `moodlit-api`. Frontend dedupliziert nach `id`.
public struct Mood: Identifiable, Codable, Sendable, Hashable {
public let id: String
public let userId: String?
public let name: String
public let colors: [String]
public let animation: AnimationType
public let isPreset: Bool
public let createdAt: String
public let updatedAt: String
public init(
id: String,
userId: String?,
name: String,
colors: [String],
animation: AnimationType,
isPreset: Bool,
createdAt: String = "1970-01-01T00:00:00.000Z",
updatedAt: String = "1970-01-01T00:00:00.000Z"
) {
self.id = id
self.userId = userId
self.name = name
self.colors = colors
self.animation = animation
self.isPreset = isPreset
self.createdAt = createdAt
self.updatedAt = updatedAt
}
}
public struct MoodSequence: Identifiable, Codable, Sendable, Hashable {
public let id: String
public let userId: String
public let name: String
public let moodIds: [String]
public let durationSec: Int
public let transitionSec: Int
public let createdAt: String
public let updatedAt: String
}
public struct Preferences: Codable, Sendable, Hashable {
public enum AnimationSpeed: String, Codable, Sendable, CaseIterable {
case slow, normal, fast
}
public let userId: String
public let animationSpeed: AnimationSpeed
public let brightness: Int
public let autoTimerMinutes: Int
public let autoMoodSwitch: Bool
public let autoMoodSwitchInterval: Int
public let favoriteIds: [String]
public let createdAt: String
public let updatedAt: String
}