package model

import "time"

type PublicMemberIdentityRecord struct {
	MemberID          string
	MemberType        string
	MemberDisplayName string
	UserDisplayName   string
	UserName          string
	AgentName         string
}

type InstallableAppRecord struct {
	ID            string
	Slug          string
	Name          string
	LatestVersion string
}

type InstallableAppVersionRecord struct {
	Version                    string
	Scopes                     []string
	ConfigSchema               string
	CredentialsSchema          string
	RuntimeCapabilitySupported bool
	AppRuntimeTransports       []string
	AppCallbackURL             string
}

type StoredAppInstallation struct {
	ID                string
	AppID             string
	AppSlug           string
	AppName           string
	WorkspaceID       string
	InstanceKey       string
	MemberID          string
	Handle            string
	MemberDisplayName string
	InstalledVersion  string
	Config            []byte
	Enabled           bool
	CreatedByUserID   string
	CreatedAt         time.Time
	UpdatedAt         time.Time
}

type StoredAppManifest struct {
	Scopes            []string
	ConfigSchema      string
	CredentialsSchema string
	AppCallbackURL    string
}

type LatestInstallableAppMetadata struct {
	Version      string
	ManifestJSON []byte
}

type RuntimeAppInstallation struct {
	InstallationID        string
	AppID                 string
	AppSlug               string
	AppName               string
	AppKind               string
	MemberID              string
	Handle                string
	WorkspaceID           string
	Config                []byte
	CallbackURL           string
	CallbackSigningSecret string
}

type ThreadHistoryBounds struct {
	LatestSeq        int64
	ArchivedUntilSeq int64
}

type ThreadMessageRecord struct {
	MessageID          string
	ScopeID            string
	ScopeKind          string
	ParentScopeID      string
	Seq                int64
	WorkspaceGlobalSeq int64
	AuthorMemberID     string
	AuthorType         string
	Content            string
	Metadata           map[string]any
	CreatedAt          time.Time
}

type StoredReaction struct {
	ID        string
	Emoji     string
	CreatedAt time.Time
}

type ReactionAggregateRow struct {
	MessageID   string
	Emoji       string
	Count       int
	MemberID    string
	ActorType   string
	ActorName   string
	DisplayName string
	AvatarURL   string
	ServiceKind string
	ServiceSlug string
}

type RewindDeliveryRow struct {
	MessageID        string
	GlobalSeq        int64
	DeliveredAt      time.Time
	AgentMemberID    string
	AgentID          string
	MachineID        string
	Runtime          string
	Model            string
	SessionID        string
	AgentRuntimeLive bool
}
