package model

import "time"

// SyncOutbox stores failed CP -> Redis sync operations for retry.
type SyncOutbox struct {
	ID           uint       `gorm:"primaryKey" json:"id"`
	ResourceType string     `gorm:"size:50;index" json:"resource_type"`
	Action       string     `gorm:"size:50" json:"action"`
	ResourceID   *uint      `gorm:"index" json:"resource_id,omitempty"`
	Payload      string     `gorm:"type:text" json:"payload,omitempty"`
	RetryCount   int        `gorm:"default:0" json:"retry_count"`
	LastError    string     `gorm:"type:text" json:"last_error,omitempty"`
	NextRetryAt  *time.Time `gorm:"index" json:"next_retry_at,omitempty"`
	Status       string     `gorm:"size:20;default:'pending'" json:"status"`
	CreatedAt    time.Time  `json:"created_at"`
	UpdatedAt    time.Time  `json:"updated_at"`
}
