package dto

import "time"

// WorkspaceChannelSidebarSection is one user-private channel grouping.
type WorkspaceChannelSidebarSection struct {
	ID         string   `json:"id"`
	Name       string   `json:"name"`
	Emoji      string   `json:"emoji"`
	ChannelIDs []string `json:"channelIds"`
}

// WorkspaceChannelSidebarPreferenceState is replaced atomically by PUT.
type WorkspaceChannelSidebarPreferenceState struct {
	Sections  []WorkspaceChannelSidebarSection `json:"sections"`
	Collapsed map[string]bool                  `json:"collapsed"`
}

// WorkspaceChannelSidebarPreferenceUpdateRequest conditionally replaces one
// member's sidebar state. A nil ExpectedRevision creates the initial row;
// subsequent writes must carry the revision returned by GET/PUT.
type WorkspaceChannelSidebarPreferenceUpdateRequest struct {
	Preference       WorkspaceChannelSidebarPreferenceState `json:"preference"`
	ExpectedRevision *int64                                 `json:"expectedRevision"`
}

// WorkspaceChannelSidebarPreferenceResponse distinguishes an absent server
// preference from an explicitly saved empty preference for local migration.
type WorkspaceChannelSidebarPreferenceResponse struct {
	Preference *WorkspaceChannelSidebarPreferenceState `json:"preference"`
	Revision   *int64                                  `json:"revision"`
	UpdatedAt  *time.Time                              `json:"updatedAt"`
}
