// NKSC1-c8c7ea42327292095dea8150adbebc85-0708f3a4174e426d0d2ad28718b26adb4894e3d58893d8e7340ae63a514fbf41

package models

import "time"

// The oldest canonical message in ChatHistory is the durable page cursor.
// This record preserves operator intent and retry state across process restarts.
type HistorySyncJob struct {
	AgentID        uint       `gorm:"primaryKey" json:"agent_id"`
	Sender         string     `gorm:"size:32;not null" json:"sender"`
	State          string     `gorm:"size:24;index;not null" json:"state"`
	PagesCompleted int        `gorm:"not null;default:0" json:"pages_completed"`
	Attempts       int        `gorm:"not null;default:0" json:"attempts"`
	LastError      string     `gorm:"type:text" json:"last_error"`
	StartedAt      time.Time  `json:"started_at"`
	FinishedAt     *time.Time `json:"finished_at,omitempty"`
	UpdatedAt      time.Time  `json:"updated_at"`
}
