using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using Microsoft.Maui.Graphics; namespace cfs_tracker.ViewModels; public partial class DayEntryItemViewModel : ObservableObject { public int Id { get; init; } public string TimeText { get; init; } = string.Empty; public string StateText { get; init; } = string.Empty; public string ActivityText { get; init; } = string.Empty; public string SymptomsText { get; init; } = string.Empty; public bool HasActivity => !string.IsNullOrWhiteSpace(ActivityText); public bool HasSymptoms => !string.IsNullOrWhiteSpace(SymptomsText); public bool HasDetails => HasActivity || HasSymptoms; public string FoldoutText => IsExpanded ? "Details ausblenden" : "Details anzeigen"; public Color BackgroundColor { get; init; } = Colors.Transparent; public Color TextColor { get; init; } = Colors.White; [ObservableProperty] private bool isExpanded; public IRelayCommand ToggleExpandedCommand { get; } public DayEntryItemViewModel() { ToggleExpandedCommand = new RelayCommand(ToggleExpanded); } private void ToggleExpanded() { if (!HasDetails) return; IsExpanded = !IsExpanded; OnPropertyChanged(nameof(FoldoutText)); } }