package db import "time" // ApprovalStatus defines the lifecycle states for a tool call approval. type ApprovalStatus string const ( ApprovalStatusApproved ApprovalStatus = "approved" ApprovalStatusDenied ApprovalStatus = "denied" ApprovalStatusPending ApprovalStatus = "pending" ) // Approval represents a tool call awaiting or resolved by user permission. type Approval struct { CreatedAt time.Time `json:"created_at"` Id string `json:"id"` MessageId string `json:"message_id"` Status ApprovalStatus `json:"status"` ToolCallId string `json:"tool_call_id"` UpdatedAt time.Time `json:"updated_at"` } // Conversation represents a stored conversation. type Conversation struct { CreatedAt time.Time `json:"created_at"` Id string `json:"id"` Title *string `json:"title"` UpdatedAt time.Time `json:"updated_at"` UserId string `json:"user_id"` } // MessageRole defines the permitted roles for messages. type MessageRole string const ( MessageRoleSystem MessageRole = "system" MessageRoleDeveloper MessageRole = "developer" MessageRoleUser MessageRole = "user" MessageRoleAssistant MessageRole = "assistant" MessageRoleTool MessageRole = "tool" ) // Message represents a stored chat message. Content holds the // wire-format JSON for the message — the exact JSON object that // appears in the OpenAI Chat Completions messages array. type Message struct { Content string `json:"content"` ConversationId string `json:"conversation_id"` CreatedAt time.Time `json:"created_at"` Id string `json:"id"` Role MessageRole `json:"role"` Sequence int `json:"sequence"` UpdatedAt time.Time `json:"updated_at"` } // Session represents a user login session. type Session struct { CreatedAt time.Time `json:"created_at"` DeactivatedAt *time.Time `json:"deactivated_at"` Id string `json:"id"` UpdatedAt time.Time `json:"updated_at"` UserId string `json:"user_id"` } // UserRole defines the permitted roles for users. type UserRole string const ( UserRoleOwner UserRole = "owner" ) // User represents a stored user account. type User struct { CreatedAt time.Time `json:"created_at"` DeactivatedAt *time.Time `json:"deactivated_at"` Id string `json:"id"` Name string `json:"name"` Password string `json:"password"` Role UserRole `json:"role"` UpdatedAt time.Time `json:"updated_at"` }