package model

import (
	"time"

	"github.com/tidbcloud/AgentTeam/internal/core/domain"
)

// Thread tracks the append-only log state for a channel or DM.
type Thread struct {
	ID               string
	WorkspaceID      string
	Type             domain.ThreadType
	ChannelID        *string
	DMThreadID       *string
	LatestSeq        int64
	ArchivedUntilSeq int64
	LatestMessageAt  *time.Time
	CreatedAt        time.Time
	UpdatedAt        time.Time
}

// ThreadReadState tracks the last sequence consumed by a member.
type ThreadReadState struct {
	MemberID    string
	ThreadID    string
	LastReadSeq int64
	UpdatedAt   time.Time
}

// HotMessage is a message still stored in TiDB hot storage.
type HotMessage struct {
	ThreadID       string
	Seq            int64
	AuthorMemberID string
	AuthorType     domain.MemberType
	Content        string
	CreatedAt      time.Time
}
