models

package
v0.0.0-...-99e730b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CollectionAgentChannels        = "agent_channels"
	CollectionChannelUserMappings  = "channel_user_mappings"
	CollectionAgentChannelSessions = "agent_channel_sessions"
)

MongoDB collection name constants for agent channel entities.

View Source
const (
	ChannelTypeTelegram      = "telegram"
	ChannelTypeSlack         = "slack"
	ChannelTypeDiscord       = "discord"
	ChannelTypeMSTeams       = "msteams"
	ChannelTypeGoogleChat    = "googlechat"
	ChannelTypeFeishu        = "feishu"
	ChannelTypeWhatsApp      = "whatsapp"
	ChannelTypeIMessage      = "imessage"
	ChannelTypeSignal        = "signal"
	ChannelTypeLine          = "line"
	ChannelTypeMattermost    = "mattermost"
	ChannelTypeMatrix        = "matrix"
	ChannelTypeIRC           = "irc"
	ChannelTypeZalo          = "zalo"
	ChannelTypeSynologyChat  = "synology-chat"
	ChannelTypeNextcloudTalk = "nextcloud-talk"
	ChannelTypeNostr         = "nostr"
	ChannelTypeWeChatWork    = "wechatwork"
)

Channel type string constants

View Source
const (
	CollectionAgentGateways = "agent_gateways"
	CollectionGatewayTasks  = "gateway_tasks"
)

MongoDB collection name constants for agent gateway entities.

View Source
const (
	RunInstanceApp            = "app"
	RunInstanceJobExecutor    = "job_executor"
	RunInstanceIntegrationHub = "integration_hub"
	// RunInstanceChannelMonitor marks agents that are dedicated to handling
	// bidirectional channel chat (Telegram, Slack, iMessage, etc.).
	// These agents are managed by AgentMonitorService and appear in the
	// Agent Monitor dashboard.
	RunInstanceChannelMonitor = "channel_monitor"
)

RunInstance constants for AgentDefinition.RunInstance.

View Source
const (
	CollectionAgentSkills      = "agent_skills"
	CollectionAgentDefinitions = "agent_definitions"
	CollectionMCPServers       = "mcp_servers"
)

MongoDB collection name constants for agent runtime entities.

View Source
const DefaultCoordinatorPrompt = `` /* 597-byte string literal not displayed */

DefaultCoordinatorPrompt is injected as a system-prompt prefix when CoordinatorMode is true and no custom CoordinatorPrompt is set.

View Source
const DefaultGatewayCoordinatorPrompt = `` /* 650-byte string literal not displayed */

DefaultGatewayCoordinatorPrompt is injected as a system-prompt prefix when CoordinatorMode is true and no custom CoordinatorPrompt is provided. Unlike the channel variant this prompt is aware that multiple specialist agents may be registered and should be delegated to via send_to_agent.

Variables

This section is empty.

Functions

func SkillNames

func SkillNames(skills []AgentSkill) []string

ToolNames returns the skill names suitable for tool registry lookup.

Types

type AIBusinessEntity

type AIBusinessEntity struct {
	ID              int             `json:"id" gorm:"primaryKey"`
	UUID            string          `json:"uuid" gorm:"type:uuid;default:gen_random_uuid();uniqueIndex"`
	ReferenceID     *string         `json:"referenceid" gorm:"uniqueIndex"`
	ConfigID        int             `json:"config_id" gorm:"not null"`
	EntityName      string          `json:"entity_name" gorm:"not null"`
	EntityType      string          `json:"entity_type"`
	Description     string          `json:"description" gorm:"not null"`
	DatabaseAlias   *string         `json:"database_alias"`
	SchemaName      *string         `json:"schema_name"`
	MappedTableName *string         `json:"table_name" gorm:"column:table_name"`
	FieldMappings   json.RawMessage `json:"field_mappings" gorm:"type:jsonb"`
	Relationships   json.RawMessage `json:"relationships" gorm:"type:jsonb"`
	BusinessRules   json.RawMessage `json:"business_rules" gorm:"type:jsonb"`
	Metadata        json.RawMessage `json:"metadata" gorm:"type:jsonb"`
	Embedding       Vector          `json:"embedding,omitempty" gorm:"type:vector"`
	EmbeddingHash   string          `json:"embedding_hash"`
	GeneratedAt     time.Time       `json:"generated_at"`
	Active          bool            `json:"active" gorm:"default:true"`
	CreatedBy       string          `json:"createdby" gorm:"not null"`
	CreatedOn       time.Time       `json:"createdon" gorm:"default:CURRENT_TIMESTAMP"`
	ModifiedBy      *string         `json:"modifiedby"`
	ModifiedOn      *time.Time      `json:"modifiedon"`
	RowVersionStamp int             `json:"rowversionstamp" gorm:"default:1"`
}

AIBusinessEntity stores business entity definitions with embeddings (IAC Standard)

func (AIBusinessEntity) TableName

func (AIBusinessEntity) TableName() string

TableName specifies the table name for GORM

type AIConversationSession

type AIConversationSession struct {
	ID          int    `json:"id" gorm:"column:id;primaryKey;autoIncrement"`
	SessionID   string `json:"session_id" gorm:"column:session_id;type:varchar(36);not null;uniqueIndex"`
	UserID      string `json:"user_id" gorm:"column:user_id;type:varchar(36);not null"`
	EditorType  string `json:"editor_type" gorm:"column:editor_type;type:varchar(50)"` // bpm, page, view, workflow, whiteboard, report, general
	ContextData string `json:"context_data" gorm:"column:context_data;type:text"`      // JSON serialized conversation context

	// Standard IAC audit fields (must be at end)
	Active          bool         `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string       `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string       `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       sql.NullTime `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string       `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      sql.NullTime `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int          `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

AIConversationSession represents a conversation session for AI agency

func (AIConversationSession) TableName

func (AIConversationSession) TableName() string

TableName specifies the table name

type AIEmbeddingConfiguration

type AIEmbeddingConfiguration struct {
	ID                   int             `json:"id" gorm:"primaryKey"`
	UUID                 string          `json:"uuid" gorm:"column:uuid;type:uuid;default:gen_random_uuid();uniqueIndex"`
	ReferenceID          *string         `json:"referenceid" gorm:"column:referenceid;uniqueIndex"`
	ConfigName           string          `json:"config_name" gorm:"column:config_name;uniqueIndex;not null"`
	EmbeddingModel       string          `json:"embedding_model" gorm:"column:embedding_model;not null"`
	EmbeddingDimensions  int             `json:"embedding_dimensions" gorm:"column:embedding_dimensions;not null"`
	VectorDatabaseType   string          `json:"vector_database_type" gorm:"column:vector_database_type;default:postgresql"`
	VectorDatabaseConfig json.RawMessage `json:"vector_database_config" gorm:"column:vector_database_config;type:jsonb"`
	Active               bool            `json:"active" gorm:"column:active;default:true"`
	CreatedBy            string          `json:"createdby" gorm:"column:createdby;not null"`
	CreatedOn            time.Time       `json:"createdon" gorm:"column:createdon;default:CURRENT_TIMESTAMP"`
	ModifiedBy           *string         `json:"modifiedby" gorm:"column:modifiedby"`
	ModifiedOn           *time.Time      `json:"modifiedon" gorm:"column:modifiedon"`
	RowVersionStamp      int             `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

AIEmbeddingConfiguration stores AI configuration metadata (IAC Standard)

func (AIEmbeddingConfiguration) TableName

func (AIEmbeddingConfiguration) TableName() string

TableName specifies the table name for GORM

type AIGenerationLog

type AIGenerationLog struct {
	ID              string         `json:"id" gorm:"column:id;primaryKey;type:varchar(36);default:(UUID())"`
	ConversationID  *string        `json:"conversationid" gorm:"column:conversationid;type:varchar(36)"`
	MessageID       *string        `json:"messageid" gorm:"column:messageid;type:varchar(36)"`
	GenerationType  GenerationType `json:"generationtype" gorm:"column:generationtype;type:enum('sql','report','narrative','chart');not null"`
	InputPrompt     string         `json:"inputprompt" gorm:"column:inputprompt;type:text"`
	SystemPrompt    string         `json:"systemprompt" gorm:"column:systemprompt;type:text"`
	AIResponse      string         `json:"airesponse" gorm:"column:airesponse;type:text"`
	ModelName       string         `json:"modelname" gorm:"column:modelname;type:varchar(100)"`
	TokensUsed      *int           `json:"tokensused" gorm:"column:tokensused"`
	LatencyMs       *int           `json:"latencyms" gorm:"column:latencyms"`
	ConfidenceScore *float64       `json:"confidencescore" gorm:"column:confidencescore;type:decimal(3,2)"`
	WasSuccessful   bool           `json:"wassuccessful" gorm:"column:wassuccessful;default:true"`
	ErrorMessage    string         `json:"errormessage" gorm:"column:errormessage;type:text"`

	// Standard IAC audit fields (must be at end)
	Active          bool         `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string       `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string       `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       sql.NullTime `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string       `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      sql.NullTime `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int          `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

AIGenerationLog represents audit log for AI-generated content

func (AIGenerationLog) TableName

func (AIGenerationLog) TableName() string

TableName specifies the table name

type AIQueryTemplate

type AIQueryTemplate struct {
	ID                    int             `json:"id" gorm:"primaryKey"`
	UUID                  string          `json:"uuid" gorm:"type:uuid;default:gen_random_uuid();uniqueIndex"`
	ReferenceID           *string         `json:"referenceid" gorm:"uniqueIndex"`
	ConfigID              int             `json:"config_id" gorm:"not null"`
	TemplateName          string          `json:"template_name" gorm:"not null"`
	TemplateCategory      string          `json:"template_category"`
	NaturalLanguageQuery  string          `json:"natural_language_query" gorm:"not null"`
	SQLTemplate           string          `json:"sql_template" gorm:"not null"`
	Parameters            json.RawMessage `json:"parameters" gorm:"type:jsonb"`
	DatabaseAlias         *string         `json:"database_alias"`
	EntitiesUsed          json.RawMessage `json:"entities_used" gorm:"type:jsonb"`
	ExampleQueries        json.RawMessage `json:"example_queries" gorm:"type:jsonb"`
	ExpectedResultsSchema json.RawMessage `json:"expected_results_schema" gorm:"type:jsonb"`
	UsageCount            int             `json:"usage_count" gorm:"default:0"`
	LastUsedAt            *time.Time      `json:"last_used_at"`
	Embedding             Vector          `json:"embedding,omitempty" gorm:"type:vector"`
	EmbeddingHash         string          `json:"embedding_hash"`
	GeneratedAt           time.Time       `json:"generated_at"`
	Active                bool            `json:"active" gorm:"default:true"`
	CreatedBy             string          `json:"createdby" gorm:"not null"`
	CreatedOn             time.Time       `json:"createdon" gorm:"default:CURRENT_TIMESTAMP"`
	ModifiedBy            *string         `json:"modifiedby"`
	ModifiedOn            *time.Time      `json:"modifiedon"`
	RowVersionStamp       int             `json:"rowversionstamp" gorm:"default:1"`
}

AIQueryTemplate stores SQL query templates with embeddings (IAC Standard)

func (AIQueryTemplate) TableName

func (AIQueryTemplate) TableName() string

TableName specifies the table name for GORM

type AIScheduleBatchJob

type AIScheduleBatchJob struct {
	ID               string                   `json:"id" db:"id" gorm:"column:id;type:varchar(100);primaryKey"`
	ParentJobID      string                   `json:"parent_job_id" db:"parent_job_id" gorm:"column:parent_job_id;type:varchar(100)"`
	TotalBatches     int                      `json:"total_batches" db:"total_batches" gorm:"column:total_batches;type:int;default:0"`
	CompletedBatches int                      `json:"completed_batches" db:"completed_batches" gorm:"column:completed_batches;type:int;default:0"`
	FailedBatches    int                      `json:"failed_batches" db:"failed_batches" gorm:"column:failed_batches;type:int;default:0"`
	Status           AIScheduleBatchJobStatus `json:"status" db:"status" gorm:"column:status;type:varchar(20);default:'pending'"`
	Objective        string                   `json:"objective" db:"objective" gorm:"column:objective;type:text"`
	TotalTasks       int                      `json:"total_tasks" db:"total_tasks" gorm:"column:total_tasks;type:int;default:0"`
	ProcessedTasks   int                      `json:"processed_tasks" db:"processed_tasks" gorm:"column:processed_tasks;type:int;default:0"`
	BatchSize        int                      `json:"batch_size" db:"batch_size" gorm:"column:batch_size;type:int;default:30"`
	Progress         int                      `json:"progress" db:"progress" gorm:"column:progress;type:int;default:0"`
	ErrorMessage     string                   `json:"error_message" db:"error_message" gorm:"column:error_message;type:text"`
	StartedAt        *time.Time               `json:"started_at" db:"started_at" gorm:"column:started_at;type:timestamp"`
	CompletedAt      *time.Time               `json:"completed_at" db:"completed_at" gorm:"column:completed_at;type:timestamp"`
	ReferenceID      int                      `json:"referenceid" db:"referenceid" gorm:"column:referenceid;type:int"`
	ModifiedOn       time.Time                `json:"modifiedon" db:"modifiedon" gorm:"column:modifiedon;type:datetime;autoUpdateTime"`
	ModifiedBy       string                   `json:"modifiedby" db:"modifiedby" gorm:"column:modifiedby;type:varchar(50)"`
	CreatedOn        time.Time                `json:"createdon" db:"createdon" gorm:"column:createdon;type:datetime;autoCreateTime"`
	CreatedBy        string                   `json:"createdby" db:"createdby" gorm:"column:createdby;type:varchar(50)"`
	Active           bool                     `json:"active" db:"active" gorm:"column:active;type:boolean;default:1"`
	RowVersionStamp  int                      `json:"rowversionstamp" db:"rowversionstamp" gorm:"column:rowversionstamp;type:int;default:1"`
}

AIScheduleBatchJob represents a batch AI schedule optimization job

func (AIScheduleBatchJob) TableName

func (AIScheduleBatchJob) TableName() string

TableName specifies the table name for GORM

type AIScheduleBatchJobStatus

type AIScheduleBatchJobStatus string

AIScheduleBatchJobStatus represents the status of a batch job

const (
	BatchStatusPending    AIScheduleBatchJobStatus = "pending"
	BatchStatusProcessing AIScheduleBatchJobStatus = "processing"
	BatchStatusCompleted  AIScheduleBatchJobStatus = "completed"
	BatchStatusFailed     AIScheduleBatchJobStatus = "failed"
	BatchStatusPartial    AIScheduleBatchJobStatus = "partial" // Some batches succeeded, some failed
)

type AIScheduleBatchResult

type AIScheduleBatchResult struct {
	ID              string     `json:"id" db:"id" gorm:"column:id;type:varchar(100);primaryKey"`
	BatchJobID      string     `json:"batch_job_id" db:"batch_job_id" gorm:"column:batch_job_id;type:varchar(100);not null"`
	BatchNumber     int        `json:"batch_number" db:"batch_number" gorm:"column:batch_number;type:int;not null"`
	TasksJSON       string     `json:"tasks_json" db:"tasks_json" gorm:"column:tasks_json;type:longtext"`
	ChangesJSON     string     `json:"changes_json" db:"changes_json" gorm:"column:changes_json;type:longtext"`
	StartIndex      int        `json:"start_index" db:"start_index" gorm:"column:start_index;type:int;not null"`
	EndIndex        int        `json:"end_index" db:"end_index" gorm:"column:end_index;type:int;not null"`
	Status          string     `json:"status" db:"status" gorm:"column:status;type:varchar(20);default:'pending'"`
	ErrorMessage    string     `json:"error_message" db:"error_message" gorm:"column:error_message;type:text"`
	ProcessedAt     *time.Time `json:"processed_at" db:"processed_at" gorm:"column:processed_at;type:timestamp"`
	ReferenceID     int        `json:"referenceid" db:"referenceid" gorm:"column:referenceid;type:int"`
	ModifiedOn      time.Time  `json:"modifiedon" db:"modifiedon" gorm:"column:modifiedon;type:datetime;autoUpdateTime"`
	ModifiedBy      string     `json:"modifiedby" db:"modifiedby" gorm:"column:modifiedby;type:varchar(50)"`
	CreatedOn       time.Time  `json:"createdon" db:"createdon" gorm:"column:createdon;type:datetime;autoCreateTime"`
	CreatedBy       string     `json:"createdby" db:"createdby" gorm:"column:createdby;type:varchar(50)"`
	Active          bool       `json:"active" db:"active" gorm:"column:active;type:boolean;default:1"`
	RowVersionStamp int        `json:"rowversionstamp" db:"rowversionstamp" gorm:"column:rowversionstamp;type:int;default:1"`
}

AIScheduleBatchResult represents the result of a single batch

func (AIScheduleBatchResult) TableName

func (AIScheduleBatchResult) TableName() string

TableName specifies the table name for GORM

type APICallHistory

type APICallHistory struct {
	// Unique identifier
	ID string `json:"id" bson:"_id,omitempty"`

	// Request Information
	Method         string            `json:"method" bson:"method"`
	Endpoint       string            `json:"endpoint" bson:"endpoint"`
	FullPath       string            `json:"full_path" bson:"full_path"`
	RequestHeaders map[string]string `json:"request_headers,omitempty" bson:"request_headers,omitempty"`
	RequestBody    interface{}       `json:"request_body,omitempty" bson:"request_body,omitempty"`
	QueryParams    map[string]string `json:"query_params,omitempty" bson:"query_params,omitempty"`

	// Response Information
	StatusCode      int               `json:"status_code" bson:"status_code"`
	ResponseBody    interface{}       `json:"response_body,omitempty" bson:"response_body,omitempty"`
	ResponseHeaders map[string]string `json:"response_headers,omitempty" bson:"response_headers,omitempty"`

	// Source Information
	SourceIP      string `json:"source_ip" bson:"source_ip"`
	SourceMachine string `json:"source_machine,omitempty" bson:"source_machine,omitempty"`
	UserAgent     string `json:"user_agent,omitempty" bson:"user_agent,omitempty"`

	// User Information
	UserID   string `json:"user_id,omitempty" bson:"user_id,omitempty"`
	UserName string `json:"user_name,omitempty" bson:"user_name,omitempty"`
	ClientID string `json:"client_id,omitempty" bson:"client_id,omitempty"`
	AuthType string `json:"auth_type,omitempty" bson:"auth_type,omitempty"` // bearer, apikey, none

	// Timing Information
	StartTime  time.Time `json:"start_time" bson:"start_time"`
	EndTime    time.Time `json:"end_time" bson:"end_time"`
	DurationMs int64     `json:"duration_ms" bson:"duration_ms"`

	// Instance Information
	InstanceID   string `json:"instance_id,omitempty" bson:"instance_id,omitempty"`
	InstanceName string `json:"instance_name,omitempty" bson:"instance_name,omitempty"`

	// Error Information
	ErrorMessage string `json:"error_message,omitempty" bson:"error_message,omitempty"`

	// Metadata
	Tags     []string               `json:"tags,omitempty" bson:"tags,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty" bson:"metadata,omitempty"`
}

APICallHistory represents a single API call record

func NewAPICallHistory

func NewAPICallHistory(method, endpoint, fullPath, sourceIP string) *APICallHistory

NewAPICallHistory creates a new API call history record

func (*APICallHistory) Complete

func (h *APICallHistory) Complete(statusCode int, responseBody interface{}, errorMsg string)

Complete marks the API call as complete

func (*APICallHistory) IsError

func (h *APICallHistory) IsError() bool

IsError returns true if the status code indicates an error

func (*APICallHistory) ToListItem

func (h *APICallHistory) ToListItem() APICallHistoryListItem

ToListItem converts APICallHistory to a list item

type APICallHistoryConfig

type APICallHistoryConfig struct {
	// Unique identifier
	ID string `json:"id" bson:"_id,omitempty"`

	// Configuration Metadata
	Name        string `json:"name" bson:"name"`               // Configuration name
	Description string `json:"description" bson:"description"` // Configuration description
	IsActive    bool   `json:"is_active" bson:"is_active"`     // Whether this configuration is currently active

	// Master Enable/Disable
	Enabled bool `json:"enabled" bson:"enabled"`

	// Endpoint Filters
	IncludeEndpoints []string `json:"include_endpoints" bson:"include_endpoints"`
	ExcludeEndpoints []string `json:"exclude_endpoints" bson:"exclude_endpoints"`
	IncludeMethods   []string `json:"include_methods" bson:"include_methods"`
	ExcludeMethods   []string `json:"exclude_methods" bson:"exclude_methods"`

	// Source Filters
	IncludeSourceIPs []string `json:"include_source_ips" bson:"include_source_ips"`
	ExcludeSourceIPs []string `json:"exclude_source_ips" bson:"exclude_source_ips"`
	IncludeUsers     []string `json:"include_users" bson:"include_users"`
	ExcludeUsers     []string `json:"exclude_users" bson:"exclude_users"`

	// Status Filters
	IncludeStatusCodes []int `json:"include_status_codes" bson:"include_status_codes"`
	ExcludeStatusCodes []int `json:"exclude_status_codes" bson:"exclude_status_codes"`
	OnlyErrors         bool  `json:"only_errors" bson:"only_errors"`

	// Data Capture Options
	CaptureRequestBody  bool `json:"capture_request_body" bson:"capture_request_body"`
	CaptureResponseBody bool `json:"capture_response_body" bson:"capture_response_body"`
	CaptureHeaders      bool `json:"capture_headers" bson:"capture_headers"`
	MaxBodySize         int  `json:"max_body_size" bson:"max_body_size"`

	// Sensitive Data Handling
	MaskSensitiveFields []string `json:"mask_sensitive_fields" bson:"mask_sensitive_fields"`

	// Retention
	RetentionDays int `json:"retention_days" bson:"retention_days"`

	// Sampling (for high-traffic endpoints)
	SamplingRate float64 `json:"sampling_rate" bson:"sampling_rate"`

	// Refresh interval for configuration updates (in minutes) - 0 means default (5)
	RefreshInterval int `json:"refresh_interval" bson:"refresh_interval"`

	// Audit Information
	UpdatedBy string    `json:"updated_by" bson:"updated_by"`
	UpdatedAt time.Time `json:"updated_at" bson:"updated_at"`
	CreatedAt time.Time `json:"created_at" bson:"created_at"`
}

APICallHistoryConfig represents the configuration for API call tracking

func NewAPICallHistoryConfig

func NewAPICallHistoryConfig() *APICallHistoryConfig

NewAPICallHistoryConfig creates a new configuration with default values

func (*APICallHistoryConfig) ShouldTrack

func (c *APICallHistoryConfig) ShouldTrack(method, endpoint, sourceIP, userID string, statusCode int) bool

ShouldTrack determines if an API call should be tracked based on the configuration

type APICallHistoryListItem

type APICallHistoryListItem struct {
	ID         string    `json:"id"`
	Method     string    `json:"method"`
	Endpoint   string    `json:"endpoint"`
	StatusCode int       `json:"status_code"`
	DurationMs int64     `json:"duration_ms"`
	SourceIP   string    `json:"source_ip"`
	UserID     string    `json:"user_id,omitempty"`
	UserName   string    `json:"user_name,omitempty"`
	StartTime  time.Time `json:"start_time"`
}

APICallHistoryListItem represents a summary item for listing

type APICallHistoryStats

type APICallHistoryStats struct {
	TotalCalls        int64            `json:"total_calls"`
	SuccessfulCalls   int64            `json:"successful_calls"`
	FailedCalls       int64            `json:"failed_calls"`
	ErrorRate         float64          `json:"error_rate"`
	AverageDurationMs float64          `json:"average_duration_ms"`
	MinDurationMs     int64            `json:"min_duration_ms"`
	MaxDurationMs     int64            `json:"max_duration_ms"`
	CallsByMethod     map[string]int64 `json:"calls_by_method"`
	CallsByStatus     map[string]int64 `json:"calls_by_status"`
	TopEndpoints      []EndpointStat   `json:"top_endpoints"`
	TopUsers          []UserStat       `json:"top_users"`
}

APICallHistoryStats represents statistics for API calls

type ActiveMonitorInfo

type ActiveMonitorInfo struct {
	AgentID     string    `json:"agent_id"`
	AgentName   string    `json:"agent_name"`
	ChannelID   string    `json:"channel_id"`
	ChannelName string    `json:"channel_name"`
	ChannelType string    `json:"channel_type"`
	StartedAt   time.Time `json:"started_at"`
}

ActiveMonitorInfo is returned by GET /api/agentmonitor/monitors and lists all running channel_monitor (agent, channel) bindings.

type AgentCardConfig

type AgentCardConfig struct {
	DisplayName string           `json:"display_name" bson:"display_name"`
	Description string           `json:"description"  bson:"description"`
	Provider    string           `json:"provider"     bson:"provider"`
	ProviderURL string           `json:"provider_url" bson:"provider_url"`
	Skills      []AgentCardSkill `json:"skills"       bson:"skills"`
}

AgentCardConfig holds the Google A2A agent card metadata for a gateway.

type AgentCardSkill

type AgentCardSkill struct {
	ID          string `json:"id"          bson:"id"`
	Name        string `json:"name"        bson:"name"`
	Description string `json:"description" bson:"description"`
}

AgentCardSkill represents a capability advertised on the A2A agent card.

type AgentChannelDoc

type AgentChannelDoc struct {
	ID             string                     `json:"_id"               bson:"_id"`
	AgentID        string                     `json:"agent_id"          bson:"agent_id"`
	AgentName      string                     `json:"agent_name"        bson:"agent_name"`
	ChannelType    string                     `json:"channel_type"      bson:"channel_type"`
	DisplayName    string                     `json:"display_name"      bson:"display_name"`
	ChannelConfig  map[string]string          `json:"channel_config"    bson:"channel_config"`
	SecurityPolicy AgentChannelSecurityPolicy `json:"security_policy"   bson:"security_policy"`
	WelcomeMessage string                     `json:"welcome_message"   bson:"welcome_message"`
	StartMessage   string                     `json:"start_message"     bson:"start_message"`
	StopMessage    string                     `json:"stop_message"      bson:"stop_message"`
	// CoordinatorMode enables multi-tool/multi-agent coordination behaviour.
	// When true the bound agent receives a coordinator system-prompt prefix that
	// directs it to analyse the incoming message, select the right tools
	// (possibly more than one), execute them in sequence, and return an
	// aggregated answer. CoordinatorPrompt overrides the default prefix.
	CoordinatorMode   bool   `json:"coordinator_mode"   bson:"coordinator_mode"`
	CoordinatorPrompt string `json:"coordinator_prompt" bson:"coordinator_prompt"`
	Enabled           bool   `json:"enabled"           bson:"enabled"`
	Active            bool   `json:"active"            bson:"active"`
	CreatedBy         string `json:"createdby"         bson:"createdby"`
	CreatedOn         string `json:"createdon"         bson:"createdon"` // RFC 3339 string
	ModifiedBy        string `json:"modifiedby"        bson:"modifiedby"`
	ModifiedOn        string `json:"modifiedon"        bson:"modifiedon"`
}

AgentChannelDoc is the MongoDB document for an agent-channel binding. One IAC agent can have multiple channel bindings.

type AgentChannelPolicyKey

type AgentChannelPolicyKey struct{}

agentChannelPolicyKey is the context key used to pass security policy to AgentRunnerService.

type AgentChannelSecurityPolicy

type AgentChannelSecurityPolicy struct {
	RequireUserAuth      bool     `json:"require_user_auth"      bson:"require_user_auth"`
	AllowedTools         []string `json:"allowed_tools"          bson:"allowed_tools"`
	BlockedTools         []string `json:"blocked_tools"          bson:"blocked_tools"`
	MaxIterations        int      `json:"max_iterations"         bson:"max_iterations"`
	MaxResponseLength    int      `json:"max_response_length"    bson:"max_response_length"`
	RateLimitPerHour     int      `json:"rate_limit_per_hour"    bson:"rate_limit_per_hour"`
	SystemPromptOverride string   `json:"system_prompt_override" bson:"system_prompt_override"`
}

AgentChannelSecurityPolicy controls what channel users can do via this channel.

type AgentChannelSessionDoc

type AgentChannelSessionDoc struct {
	ID             string `json:"_id"               bson:"_id"`
	AgentChannelID string `json:"agent_channel_id"  bson:"agent_channel_id"`
	ChannelUserID  string `json:"channel_user_id"   bson:"channel_user_id"`
	ConversationID string `json:"conversation_id"   bson:"conversation_id"`
	MessageCount   int    `json:"message_count"     bson:"message_count"`
	LastMessageOn  string `json:"last_message_on"   bson:"last_message_on"`
	Active         bool   `json:"active"            bson:"active"`
	CreatedOn      string `json:"createdon"         bson:"createdon"`
}

AgentChannelSessionDoc tracks conversation continuity per channel user.

type AgentCoordinatorPromptKey

type AgentCoordinatorPromptKey struct{}

AgentCoordinatorPromptKey carries the coordinator prompt prefix into AgentRunnerService.

type AgentDefinition

type AgentDefinition struct {
	ID            string  `json:"id"            gorm:"column:id;primaryKey;type:varchar(36)"`
	Name          string  `json:"name"          gorm:"column:name;type:varchar(100);not null"`
	Description   string  `json:"description"   gorm:"column:description;type:text"`
	Avatar        string  `json:"avatar"        gorm:"column:avatar;type:varchar(500)"`
	ModelProvider string  `json:"modelprovider" gorm:"column:model_provider;type:varchar(50);not null;default:'openai'"`
	ModelName     string  `json:"modelname"     gorm:"column:model_name;type:varchar(100);not null;default:'gpt-4o'"`
	SystemPrompt  string  `json:"systemprompt"  gorm:"column:system_prompt;type:text;not null"`
	MaxIterations int     `json:"maxiterations" gorm:"column:max_iterations;not null;default:10"`
	Temperature   float64 `json:"temperature"   gorm:"column:temperature;type:decimal(3,2);not null;default:0.70"`
	IsDefault     bool    `json:"isdefault"     gorm:"column:is_default;not null;default:false"`
	Enabled       bool    `json:"enabled"       gorm:"column:enabled;not null;default:true"`
	RunInstance   string  `json:"runinstance"   gorm:"column:run_instance;type:varchar(50);not null;default:'app'"`

	// NotificationConfig stores per-agent notification credentials and settings.
	// Keys: telegram_bot_token, telegram_chat_id, slack_webhook_url, smtp_from,
	//       teams_webhook_url, discord_webhook_url.
	// Values here override system-level defaults from configuration.json but are
	// overridden by parameters supplied per-call.
	NotificationConfig JSONBMap `json:"notificationconfig" gorm:"column:notification_config;type:jsonb;default:'{}'"`

	// Skills assigned to this agent — populated at runtime by AgentDefinitionService from MongoDB.
	// GORM does not manage this field; it is hydrated via MongoDB skill_names array.
	Skills []AgentSkill `json:"skills" gorm:"-"`

	// MCPServers assigned to this agent — populated at runtime by AgentDefinitionService from MongoDB.
	// GORM does not manage this field; it is hydrated via MongoDB mcp_server_ids array.
	MCPServers []MCPServer `json:"mcpservers" gorm:"-"`

	// SkillNames holds the raw skill name strings stored in the MongoDB document.
	// Used internally during conversion between AgentDefinitionDoc and AgentDefinition.
	SkillNames []string `json:"skillnames,omitempty" gorm:"-"`

	// Standard IAC audit fields
	Active          bool         `json:"active"          gorm:"column:active;not null;default:true"`
	ReferenceID     string       `json:"referenceid"     gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string       `json:"createdby"       gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       sql.NullTime `json:"createdon"       gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string       `json:"modifiedby"      gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      sql.NullTime `json:"modifiedon"      gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int          `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

AgentDefinition represents a configured AI agent. Skills are managed via the agent_definition_skills join table.

func AgentDefinitionDocToModel

func AgentDefinitionDocToModel(d *AgentDefinitionDoc) *AgentDefinition

AgentDefinitionDocToModel converts an AgentDefinitionDoc to an AgentDefinition model. Skills and MCPServers are left empty; the caller must hydrate them.

func (AgentDefinition) TableName

func (AgentDefinition) TableName() string

type AgentDefinitionDoc

type AgentDefinitionDoc struct {
	ID                 string            `json:"_id"                          bson:"_id"`
	Name               string            `json:"name"                         bson:"name"`
	Description        string            `json:"description"                  bson:"description"`
	Avatar             string            `json:"avatar"                       bson:"avatar"`
	ModelProvider      string            `json:"model_provider"               bson:"model_provider"`
	ModelName          string            `json:"model_name"                   bson:"model_name"`
	SystemPrompt       string            `json:"system_prompt"                bson:"system_prompt"`
	MaxIterations      int               `json:"max_iterations"               bson:"max_iterations"`
	Temperature        float64           `json:"temperature"                  bson:"temperature"`
	IsDefault          bool              `json:"is_default"                   bson:"is_default"`
	Enabled            bool              `json:"enabled"                      bson:"enabled"`
	RunInstance        string            `json:"run_instance"                 bson:"run_instance"`
	NotificationConfig map[string]string `json:"notification_config,omitempty" bson:"notification_config,omitempty"`
	// SkillNames stores tool names assigned to this agent (replaces join table).
	SkillNames []string `json:"skill_names"    bson:"skill_names"`
	// MCPServerIDs stores MCP server UUIDs assigned to this agent (replaces join table).
	MCPServerIDs    []string  `json:"mcp_server_ids" bson:"mcp_server_ids"`
	Active          bool      `json:"active"          bson:"active"`
	ReferenceID     string    `json:"referenceid"     bson:"referenceid"`
	CreatedBy       string    `json:"createdby"       bson:"createdby"`
	CreatedOn       time.Time `json:"createdon"       bson:"createdon"`
	ModifiedBy      string    `json:"modifiedby"      bson:"modifiedby"`
	ModifiedOn      time.Time `json:"modifiedon"      bson:"modifiedon"`
	RowVersionStamp int       `json:"rowversionstamp" bson:"rowversionstamp"`
}

AgentDefinitionDoc is the MongoDB document representation of an agent definition. SkillNames and MCPServerIDs are embedded arrays replacing the join tables agent_definition_skills and agent_mcp_servers.

func AgentDefinitionModelToDoc

func AgentDefinitionModelToDoc(a *AgentDefinition) *AgentDefinitionDoc

AgentDefinitionModelToDoc converts a GORM AgentDefinition (with preloaded Skills and MCPServers) to an AgentDefinitionDoc for MongoDB storage. Skills and MCP server assignments are embedded as string arrays.

type AgentGatewayDoc

type AgentGatewayDoc struct {
	ID           string            `json:"_id"                bson:"_id"`
	Name         string            `json:"name"               bson:"name"`
	Description  string            `json:"description"        bson:"description"`
	WorkflowID   string            `json:"workflow_id"        bson:"workflow_id"` // optional: existing workflow doc ID
	AgentIDs     []string          `json:"agent_ids"          bson:"agent_ids"`   // agents available to this gateway
	MCPServerIDs []string          `json:"mcp_server_ids"     bson:"mcp_server_ids"`
	HubID        string            `json:"hub_id"             bson:"hub_id"`       // IntegrationHub trigger
	HubRouteID   string            `json:"hub_route_id"       bson:"hub_route_id"` // specific route within hub
	AgentCard    AgentCardConfig   `json:"agent_card"         bson:"agent_card"`   // Google A2A metadata
	OutputType   string            `json:"output_type"        bson:"output_type"`  // "response"|"webhook"|"email"
	OutputConfig map[string]string `json:"output_config"      bson:"output_config"`
	// CoordinatorMode enables multi-agent/multi-tool coordination at the gateway.
	// When true the first (coordinator) agent receives a prompt prefix that lists
	// all available agents and instructs it to route/delegate via send_to_agent.
	CoordinatorMode   bool   `json:"coordinator_mode"   bson:"coordinator_mode"`
	CoordinatorPrompt string `json:"coordinator_prompt" bson:"coordinator_prompt"`
	Enabled           bool   `json:"enabled"            bson:"enabled"`
	Active            bool   `json:"active"             bson:"active"`
	CreatedBy         string `json:"createdby"          bson:"createdby"`
	CreatedOn         string `json:"createdon"          bson:"createdon"` // RFC 3339 string
	ModifiedBy        string `json:"modifiedby"         bson:"modifiedby"`
	ModifiedOn        string `json:"modifiedon"         bson:"modifiedon"`
}

AgentGatewayDoc is the MongoDB document representation of an Agent Gateway. An Agent Gateway packages the agent ReAct execution behind a standard A2A protocol endpoint and can be triggered by IntegrationHub routes.

type AgentJobPayload

type AgentJobPayload struct {
	AgentDefinitionID string `json:"agentdefinitionid"`
	AgentScheduleID   string `json:"agentscheduleid,omitempty"`
	ConversationID    string `json:"conversationid"`
	TaskPrompt        string `json:"taskprompt"`
	RequestedBy       string `json:"requestedby"`
}

AgentJobPayload is the JSON payload stored in QueueJob.Payload for agent runner jobs

type AgentMemory

type AgentMemory struct {
	ID                string        `json:"id"                 gorm:"column:id;primaryKey;type:varchar(36)"`
	AgentDefinitionID string        `json:"agentdefinitionid"  gorm:"column:agent_definition_id;type:varchar(36);not null"`
	Title             string        `json:"title"              gorm:"column:title;type:varchar(200);not null"`
	Summary           string        `json:"summary"            gorm:"column:summary;type:text"`
	Content           string        `json:"content"            gorm:"column:content;type:text"`
	ContentType       string        `json:"contenttype"        gorm:"column:content_type;type:varchar(50);not null;default:'text'"`
	Tags              StringSlice   `json:"tags"               gorm:"column:tags;type:jsonb;default:'[]'"`
	Layer             string        `json:"layer"              gorm:"column:layer;type:varchar(2);not null;default:'L1'"`
	Priority          string        `json:"priority"           gorm:"column:priority;type:varchar(2);not null;default:'P1'"`
	RetentionType     string        `json:"retentiontype"      gorm:"column:retention_type;type:varchar(20);not null;default:'permanent'"`
	RetentionDays     *int          `json:"retentiondays"      gorm:"column:retention_days"`
	ExpiresAt         *sql.NullTime `json:"expiresat"          gorm:"column:expires_at"`
	AccessCount       int           `json:"accesscount"        gorm:"column:access_count;not null;default:0"`
	LastAccessedOn    *sql.NullTime `json:"lastaccessedon"     gorm:"column:last_accessed_on"`
	Active            bool          `json:"active"             gorm:"column:active;not null;default:true"`
	Archived          bool          `json:"archived"           gorm:"column:archived;not null;default:false"`
	CreatedBy         string        `json:"createdby"          gorm:"column:createdby;type:varchar(45)"`
	CreatedOn         sql.NullTime  `json:"createdon"          gorm:"column:createdon;autoCreateTime"`
	ModifiedBy        string        `json:"modifiedby"         gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn        sql.NullTime  `json:"modifiedon"         gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp   int           `json:"rowversionstamp"    gorm:"column:rowversionstamp;default:1"`
}

AgentMemory stores a single memory item for an agent, using a 3-layer system. L0 = lightweight index (title + brief), L1 = summary, L2 = full content. Priority: P0 = critical/permanent, P1 = normal, P2 = low/disposable. Retention: permanent | interval (auto-archive after N days) | temporary (expires_at).

func (AgentMemory) TableName

func (AgentMemory) TableName() string

type AgentSchedule

type AgentSchedule struct {
	ID                string        `json:"id"                gorm:"column:id;primaryKey;type:varchar(36)"`
	AgentDefinitionID string        `json:"agentdefinitionid" gorm:"column:agent_definition_id;type:varchar(36);not null"`
	Name              string        `json:"name"              gorm:"column:name;type:varchar(100);not null"`
	Description       string        `json:"description"       gorm:"column:description;type:text"`
	TaskPrompt        string        `json:"taskprompt"        gorm:"column:task_prompt;type:text;not null"`
	CronExpression    string        `json:"cronexpression"    gorm:"column:cron_expression;type:varchar(100)"`
	RunOnceAt         *sql.NullTime `json:"runonceat"         gorm:"column:run_once_at"`
	LastRunAt         *sql.NullTime `json:"lastrunat"         gorm:"column:last_run_at"`
	LastRunStatus     string        `json:"lastrunstatus"     gorm:"column:last_run_status;type:varchar(20)"`
	LastRunOutput     string        `json:"lastrunoutput"     gorm:"column:last_run_output;type:text"`
	JobID             string        `json:"jobid"             gorm:"column:job_id;type:varchar(36)"`
	Enabled           bool          `json:"enabled"           gorm:"column:enabled;not null;default:true"`

	// Standard IAC audit fields
	Active          bool         `json:"active"          gorm:"column:active;not null;default:true"`
	ReferenceID     string       `json:"referenceid"     gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string       `json:"createdby"       gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       sql.NullTime `json:"createdon"       gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string       `json:"modifiedby"      gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      sql.NullTime `json:"modifiedon"      gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int          `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

AgentSchedule represents a scheduled task for an agent

func (AgentSchedule) TableName

func (AgentSchedule) TableName() string

type AgentSkill

type AgentSkill struct {
	ID              string       `json:"id"          gorm:"column:id;primaryKey;type:varchar(36)"`
	Name            string       `json:"name"        gorm:"column:name;type:varchar(100);not null;uniqueIndex"`
	DisplayName     string       `json:"displayname" gorm:"column:display_name;type:varchar(100);not null"`
	Description     string       `json:"description" gorm:"column:description;type:text"`
	Category        string       `json:"category"    gorm:"column:category;type:varchar(50)"`
	Active          bool         `json:"active"      gorm:"column:active;not null;default:true"`
	CreatedBy       string       `json:"createdby"   gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       sql.NullTime `json:"createdon"   gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string       `json:"modifiedby"  gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      sql.NullTime `json:"modifiedon"  gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int          `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
	// Installed skill metadata (not stored in PostgreSQL; populated from MongoDB only)
	SkillType   string `json:"skill_type"   gorm:"-"` // "builtin" | "installed"
	SourceURL   string `json:"source_url"   gorm:"-"` // installation source URL
	InstallPath string `json:"install_path" gorm:"-"` // on-disk directory path
	Runtime     string `json:"runtime"      gorm:"-"` // "python" | "node" | "bash" | "none"
	EntryPoint  string `json:"entry_point"  gorm:"-"` // relative path to entry script
	ToolDefs    string `json:"tool_defs"    gorm:"-"` // JSON array of ToolDefinition
	Version     string `json:"version"      gorm:"-"` // skill version string
	// Content holds extended LLM-facing instructions/schema for this skill.
	// When non-empty it is appended to the tool description seen by the LLM,
	// making the skill the authoritative source of its own spec/usage guide.
	Content string `json:"content"      gorm:"-"` // extended instructions (MongoDB only)
}

AgentSkill represents a single tool/capability available to agents. Skills are defined once in the catalog and can be assigned to many agents.

func AgentSkillDocToModel

func AgentSkillDocToModel(d *AgentSkillDoc) *AgentSkill

AgentSkillDocToModel converts an AgentSkillDoc to an AgentSkill model.

func (AgentSkill) TableName

func (AgentSkill) TableName() string

type AgentSkillDoc

type AgentSkillDoc struct {
	ID              string    `json:"_id"             bson:"_id"`
	Name            string    `json:"name"            bson:"name"`
	DisplayName     string    `json:"display_name"    bson:"display_name"`
	Description     string    `json:"description"     bson:"description"`
	Category        string    `json:"category"        bson:"category"`
	Active          bool      `json:"active"          bson:"active"`
	CreatedBy       string    `json:"createdby"       bson:"createdby"`
	CreatedOn       time.Time `json:"createdon"       bson:"createdon"`
	ModifiedBy      string    `json:"modifiedby"      bson:"modifiedby"`
	ModifiedOn      time.Time `json:"modifiedon"      bson:"modifiedon"`
	RowVersionStamp int       `json:"rowversionstamp" bson:"rowversionstamp"`
	// Installed skill metadata (empty for built-in skills)
	SkillType   string `json:"skill_type,omitempty"   bson:"skill_type,omitempty"`
	SourceURL   string `json:"source_url,omitempty"   bson:"source_url,omitempty"`
	InstallPath string `json:"install_path,omitempty" bson:"install_path,omitempty"`
	Runtime     string `json:"runtime,omitempty"      bson:"runtime,omitempty"`
	EntryPoint  string `json:"entry_point,omitempty"  bson:"entry_point,omitempty"`
	ToolDefs    string `json:"tool_defs,omitempty"    bson:"tool_defs,omitempty"`
	Version     string `json:"version,omitempty"      bson:"version,omitempty"`
	// Content holds extended LLM-facing instructions/schema for this skill.
	// Appended to the tool description at run time when non-empty.
	Content string `json:"content,omitempty"      bson:"content,omitempty"`
}

AgentSkillDoc is the MongoDB document representation of an agent skill. The _id field holds the same UUID used in the legacy PostgreSQL table.

func AgentSkillModelToDoc

func AgentSkillModelToDoc(s *AgentSkill) *AgentSkillDoc

AgentSkillModelToDoc converts a GORM AgentSkill to an AgentSkillDoc for MongoDB storage.

type Annotation

type Annotation struct {
	ID       string         `json:"id" bson:"id"`
	X        float64        `json:"x" bson:"x"` // Percentage 0-100 (for 2D)
	Y        float64        `json:"y" bson:"y"` // Percentage 0-100 (for 2D)
	Width    float64        `json:"width,omitempty" bson:"width,omitempty"`
	Height   float64        `json:"height,omitempty" bson:"height,omitempty"`
	Label    string         `json:"label" bson:"label"`
	Text     string         `json:"text" bson:"text"`
	Type     AnnotationType `json:"type" bson:"type"`
	Rotation float64        `json:"rotation,omitempty" bson:"rotation,omitempty"`
	Page     int            `json:"page,omitempty" bson:"page,omitempty"` // For PDFs
	Color    string         `json:"color,omitempty" bson:"color,omitempty"`

	// 3D Annotation fields
	WorldPosition      *WorldPosition `json:"worldPosition,omitempty" bson:"worldPosition,omitempty"`           // 3D world coordinates
	Size               float64        `json:"size,omitempty" bson:"size,omitempty"`                             // Size for 3D annotations
	Opacity            float64        `json:"opacity,omitempty" bson:"opacity,omitempty"`                       // Opacity 0-1
	ShowConnectionLine bool           `json:"showConnectionLine,omitempty" bson:"showConnectionLine,omitempty"` // Show line to annotation
}

Annotation represents an annotation on an attachment

type AnnotationType

type AnnotationType string

AnnotationType represents the type of annotation

const (
	AnnotationInfo     AnnotationType = "info"
	AnnotationWarning  AnnotationType = "warning"
	AnnotationCritical AnnotationType = "critical"
	AnnotationArrow    AnnotationType = "arrow"
	AnnotationSquare   AnnotationType = "square"
	AnnotationLine     AnnotationType = "line"
	AnnotationPin      AnnotationType = "pin"
)

type Attachment

type Attachment struct {
	ID           string            `json:"id" bson:"id"`
	Type         MediaType         `json:"type" bson:"type"`
	URL          string            `json:"url" bson:"url"`
	Name         string            `json:"name" bson:"name"`
	Annotations  []Annotation      `json:"annotations" bson:"annotations"`
	CameraOrbit  string            `json:"cameraOrbit,omitempty" bson:"cameraOrbit,omitempty"`
	CameraTarget string            `json:"cameraTarget,omitempty" bson:"cameraTarget,omitempty"`
	ThreeDConfig *ThreeDViewConfig `json:"threeDConfig,omitempty" bson:"threeDConfig,omitempty"`
	Views        []ThreeDView      `json:"views,omitempty" bson:"views,omitempty"`
}

Attachment represents a media attachment in a step

type AttachmentOverride

type AttachmentOverride struct {
	ID            string            `json:"id" bson:"id"`
	AttachmentID  string            `json:"attachmentId" bson:"attachmentId"` // Reference to root attachment
	DefaultViewID string            `json:"defaultViewId,omitempty" bson:"defaultViewId,omitempty"`
	Annotations   []Annotation      `json:"annotations,omitempty" bson:"annotations,omitempty"`
	Hidden        bool              `json:"hidden,omitempty" bson:"hidden,omitempty"`
	Views         []ThreeDView      `json:"views,omitempty" bson:"views,omitempty"`
	ThreeDConfig  *ThreeDViewConfig `json:"threeDConfig,omitempty" bson:"threeDConfig,omitempty"`
	CameraOrbit   string            `json:"cameraOrbit,omitempty" bson:"cameraOrbit,omitempty"`
	CameraTarget  string            `json:"cameraTarget,omitempty" bson:"cameraTarget,omitempty"`
}

AttachmentOverride represents step-specific customizations for root-level attachments

type AuthorizeUserRequest

type AuthorizeUserRequest struct {
	ChannelUserID   string `json:"channel_user_id"`
	ChannelUsername string `json:"channel_username"`
	IACUserID       string `json:"iac_user_id"`
	IACUsername     string `json:"iac_username"`
}

AuthorizeUserRequest is used to authorize a channel user.

type BarcodeType

type BarcodeType string

BarcodeType represents the type of barcode

const (
	BarcodeTypeCode128    BarcodeType = "code128"
	BarcodeTypeCode39     BarcodeType = "code39"
	BarcodeTypeEAN13      BarcodeType = "ean13"
	BarcodeTypeEAN8       BarcodeType = "ean8"
	BarcodeTypeUPC        BarcodeType = "upc"
	BarcodeTypeQRCode     BarcodeType = "qr_code"
	BarcodeTypeDataMatrix BarcodeType = "data_matrix"
	BarcodeTypePDF417     BarcodeType = "pdf417"
	BarcodeTypeAztec      BarcodeType = "aztec"
)

type BrokerTopic

type BrokerTopic struct {
	Topic        string `json:"topic" bson:"topic"`                 // Topic/queue name
	TrackHistory *bool  `json:"track_history" bson:"track_history"` // Enable/disable history tracking (defaults to true if nil)
}

BrokerTopic represents a message broker topic with tracking settings

func (*BrokerTopic) ShouldTrackHistory

func (bt *BrokerTopic) ShouldTrackHistory() bool

ShouldTrackHistory returns true if history tracking is enabled for a BrokerTopic Defaults to true if TrackHistory is nil

func (*BrokerTopic) UnmarshalBSONValue

func (bt *BrokerTopic) UnmarshalBSONValue(t bsontype.Type, data []byte) error

UnmarshalBSONValue handles both string (legacy) and object formats for BrokerTopic in BSON

func (*BrokerTopic) UnmarshalJSON

func (bt *BrokerTopic) UnmarshalJSON(data []byte) error

UnmarshalJSON handles both string (legacy) and object formats for BrokerTopic

type BusinessEntity

type BusinessEntity struct {
	ID            int          `json:"id" gorm:"column:id;primaryKey;autoIncrement"`
	UUID          string       `json:"uuid" gorm:"column:uuid;type:uuid;not null;uniqueIndex"`
	ReferenceID   string       `json:"referenceid" gorm:"column:referenceid;type:varchar(255);uniqueIndex"`
	ConfigID      int          `json:"config_id" gorm:"column:config_id;not null"`
	EntityName    string       `json:"entity_name" gorm:"column:entity_name;type:varchar(255);not null"`
	EntityType    string       `json:"entity_type" gorm:"column:entity_type;type:varchar(100)"`
	Description   string       `json:"description" gorm:"column:description;type:text;not null"`
	DatabaseAlias string       `json:"database_alias" gorm:"column:database_alias;type:varchar(255)"`
	SchemaName    string       `json:"schema_name" gorm:"column:schema_name;type:varchar(255)"`
	Table         string       `json:"table_name" gorm:"column:table_name;type:varchar(255)"`
	FieldMappings JSONMap      `json:"field_mappings" gorm:"column:field_mappings;type:jsonb"`
	Relationships JSONMap      `json:"relationships" gorm:"column:relationships;type:jsonb"`
	BusinessRules JSONMap      `json:"business_rules" gorm:"column:business_rules;type:jsonb"`
	Metadata      JSONMap      `json:"metadata" gorm:"column:metadata;type:jsonb"`
	Embedding     VectorArray  `json:"embedding,omitempty" gorm:"column:embedding;type:vector"`
	EmbeddingHash string       `json:"embedding_hash" gorm:"column:embedding_hash;type:varchar(64)"`
	GeneratedAt   sql.NullTime `json:"generated_at" gorm:"column:generated_at;default:CURRENT_TIMESTAMP"`

	// Standard IAC audit fields
	Active          bool         `json:"active" gorm:"column:active;default:true"`
	CreatedBy       string       `json:"createdby" gorm:"column:createdby;type:varchar(255);not null"`
	CreatedOn       sql.NullTime `json:"createdon" gorm:"column:createdon;default:CURRENT_TIMESTAMP"`
	ModifiedBy      string       `json:"modifiedby" gorm:"column:modifiedby;type:varchar(255)"`
	ModifiedOn      sql.NullTime `json:"modifiedon" gorm:"column:modifiedon"`
	RowVersionStamp int          `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

BusinessEntity represents business-level entity mappings

func (BusinessEntity) TableName

func (BusinessEntity) TableName() string

TableName specifies the table name

type BusinessEntityRequest

type BusinessEntityRequest struct {
	ConfigID      int                    `json:"config_id" binding:"required"`
	EntityName    string                 `json:"entity_name" binding:"required"`
	EntityType    string                 `json:"entity_type"`
	Description   string                 `json:"description" binding:"required"`
	DatabaseAlias *string                `json:"database_alias"`
	SchemaName    *string                `json:"schema_name"`
	TableName     *string                `json:"table_name"`
	FieldMappings map[string]interface{} `json:"field_mappings"`
	Relationships map[string]interface{} `json:"relationships"`
	BusinessRules map[string]interface{} `json:"business_rules"`
}

BusinessEntityRequest represents request to create/update business entity

type BusinessEntityType

type BusinessEntityType string

BusinessEntityType represents the type of business entity

const (
	BusinessEntityTypeEntity    BusinessEntityType = "entity"
	BusinessEntityTypeMetric    BusinessEntityType = "metric"
	BusinessEntityTypeDimension BusinessEntityType = "dimension"
)

type ChannelMessageStats

type ChannelMessageStats struct {
	ChannelID      string `json:"channel_id"`
	ChannelName    string `json:"channel_name"`
	ChannelType    string `json:"channel_type"`
	AgentName      string `json:"agent_name"`
	TotalMessages  int64  `json:"total_messages"`
	ActiveSessions int    `json:"active_sessions"`
	AvgResponseMs  int64  `json:"avg_response_ms"`
	ErrorCount     int64  `json:"error_count"`
	LastActivityAt string `json:"last_activity_at"` // RFC 3339
}

ChannelMessageStats holds aggregated statistics for one channel binding.

type ChannelUserMappingDoc

type ChannelUserMappingDoc struct {
	ID              string `json:"_id"               bson:"_id"`
	AgentChannelID  string `json:"agent_channel_id"  bson:"agent_channel_id"`
	ChannelType     string `json:"channel_type"      bson:"channel_type"`
	ChannelUserID   string `json:"channel_user_id"   bson:"channel_user_id"`
	ChannelUsername string `json:"channel_username"  bson:"channel_username"`
	IACUserID       string `json:"iac_user_id"       bson:"iac_user_id"`
	IACUsername     string `json:"iac_username"      bson:"iac_username"`
	Authorized      bool   `json:"authorized"        bson:"authorized"`
	AuthorizedBy    string `json:"authorized_by"     bson:"authorized_by"`
	AuthorizedOn    string `json:"authorized_on"     bson:"authorized_on"`
	LastSeenOn      string `json:"last_seen_on"      bson:"last_seen_on"`
	Active          bool   `json:"active"            bson:"active"`
	CreatedOn       string `json:"createdon"         bson:"createdon"`
}

ChannelUserMappingDoc links external channel identities to IAC users.

type ChartType

type ChartType string

ChartType represents the type of chart

const (
	ChartTypeLine        ChartType = "line"
	ChartTypeBar         ChartType = "bar"
	ChartTypePie         ChartType = "pie"
	ChartTypeArea        ChartType = "area"
	ChartTypeScatter     ChartType = "scatter"
	ChartTypeDonut       ChartType = "donut"
	ChartTypeStackedBar  ChartType = "stacked_bar"
	ChartTypeStackedArea ChartType = "stacked_area"
	ChartTypeBar3D       ChartType = "bar_3d"
	ChartTypePie3D       ChartType = "pie_3d"
	ChartTypeLine3D      ChartType = "line_3d"
)

type ChatMessage

type ChatMessage struct {
	ID              string      `json:"id" gorm:"column:id;primaryKey;type:varchar(36);default:(UUID())"`
	ConversationID  string      `json:"conversationid" gorm:"column:conversationid;type:varchar(36);not null"`
	MessageType     MessageType `json:"messagetype" gorm:"column:messagetype;type:enum('user','assistant');default:'user'"`
	Text            string      `json:"text" gorm:"column:text;type:text;not null"`
	SQLQuery        string      `json:"sqlquery" gorm:"column:sqlquery;type:text"`
	SQLConfidence   *float64    `json:"sqlconfidence" gorm:"column:sqlconfidence;type:decimal(3,2)"`
	ResultData      JSONMap     `json:"resultdata" gorm:"column:resultdata;type:json"`
	RowCount        *int        `json:"rowcount" gorm:"column:rowcount"`
	ExecutionTimeMs *int        `json:"executiontimems" gorm:"column:executiontimems"`
	ErrorMessage    string      `json:"errormessage" gorm:"column:errormessage;type:text"`
	ChartMetadata   JSONMap     `json:"chartmetadata" gorm:"column:chartmetadata;type:json"`
	Provenance      JSONMap     `json:"provenance" gorm:"column:provenance;type:json"`
	// Rich tool outputs (ui_render, html_report, etc.) saved per agent run.
	// Stored as {"items":[{"tool":"ui_render","result":{...}}, ...]}
	ToolResults JSONMap `json:"toolresults" gorm:"column:toolresults;type:json"`

	// Standard IAC audit fields (must be at end)
	Active          bool         `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string       `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string       `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       sql.NullTime `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string       `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      sql.NullTime `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int          `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

ChatMessage represents a message in a conversation

func (ChatMessage) TableName

func (ChatMessage) TableName() string

TableName specifies the table name

type CleanupIntHubHistoryRequest

type CleanupIntHubHistoryRequest struct {
	OlderThanDays int `json:"older_than_days" binding:"required,min=1"`
}

CleanupIntHubHistoryRequest represents a cleanup request

type CleanupIntHubHistoryResponse

type CleanupIntHubHistoryResponse struct {
	Message string    `json:"message"`
	Deleted int64     `json:"deleted"`
	Cutoff  time.Time `json:"cutoff"`
}

CleanupIntHubHistoryResponse represents a cleanup response

type ClusterStatus

type ClusterStatus struct {
	TotalInstances     int                    `json:"total_instances"`
	HealthyInstances   int                    `json:"healthy_instances"`
	DegradedInstances  int                    `json:"degraded_instances"`
	UnhealthyInstances int                    `json:"unhealthy_instances"`
	InstancesByRole    map[InstanceRole]int   `json:"instances_by_role"`
	InstancesByStatus  map[InstanceStatus]int `json:"instances_by_status"`
	Instances          []*InstanceRegistry    `json:"instances,omitempty"`
	LastUpdated        time.Time              `json:"last_updated"`
}

ClusterStatus represents the overall cluster status

type ComponentHealth

type ComponentHealth struct {
	Status  string `json:"status" bson:"status"` // healthy, unhealthy, degraded
	Message string `json:"message,omitempty" bson:"message,omitempty"`
	Latency int64  `json:"latency_ms,omitempty" bson:"latency_ms,omitempty"`
}

ComponentHealth represents the health of a specific component

type ComponentType

type ComponentType string

ComponentType represents the type of report component

const (
	ComponentTypeTable      ComponentType = "table"
	ComponentTypeChart      ComponentType = "chart"
	ComponentTypeBarcode    ComponentType = "barcode"
	ComponentTypeSubReport  ComponentType = "sub_report"
	ComponentTypeText       ComponentType = "text"
	ComponentTypeImage      ComponentType = "image"
	ComponentTypeDrillDown  ComponentType = "drill_down"
	ComponentTypePageBreak  ComponentType = "page-break"
	ComponentTypePageHeader ComponentType = "page-header"
	ComponentTypePageFooter ComponentType = "page-footer"
)

type ConfigChange

type ConfigChange struct {
	Path      string      `json:"path" bson:"path"`
	OldValue  interface{} `json:"old_value,omitempty" bson:"old_value,omitempty"`
	NewValue  interface{} `json:"new_value,omitempty" bson:"new_value,omitempty"`
	Operation string      `json:"operation" bson:"operation"` // add, update, delete
}

ConfigChange represents a single configuration change

type ConfigReloadEvent

type ConfigReloadEvent struct {
	ConfigID       string    `json:"config_id"`
	ConfigName     string    `json:"config_name"`
	Version        string    `json:"version"`
	Environment    string    `json:"environment"`
	Action         string    `json:"action"` // activated, updated, rolled_back
	SourceInstance string    `json:"source_instance"`
	Timestamp      time.Time `json:"timestamp"`
}

ConfigReloadEvent represents a configuration reload event for SignalR notification

type ConfigurationHistory

type ConfigurationHistory struct {
	ID           string                 `json:"id" bson:"_id,omitempty"`
	ConfigID     string                 `json:"config_id" bson:"config_id"`
	ConfigName   string                 `json:"config_name" bson:"config_name"`
	Version      string                 `json:"version" bson:"version"`
	Environment  string                 `json:"environment" bson:"environment"`
	Action       string                 `json:"action" bson:"action"` // created, updated, activated, archived, rolled_back
	Changes      []ConfigChange         `json:"changes,omitempty" bson:"changes,omitempty"`
	PreviousData map[string]interface{} `json:"previous_data,omitempty" bson:"previous_data,omitempty"`
	NewData      map[string]interface{} `json:"new_data,omitempty" bson:"new_data,omitempty"`
	PerformedBy  string                 `json:"performed_by" bson:"performed_by"`
	PerformedAt  time.Time              `json:"performed_at" bson:"performed_at"`
	Reason       string                 `json:"reason,omitempty" bson:"reason,omitempty"`
	InstanceID   string                 `json:"instance_id,omitempty" bson:"instance_id,omitempty"`
}

ConfigurationHistory represents a change history entry

func NewConfigurationHistory

func NewConfigurationHistory(configID, configName, version, environment, action, performedBy string) *ConfigurationHistory

NewConfigurationHistory creates a new history entry

func (*ConfigurationHistory) AddChange

func (h *ConfigurationHistory) AddChange(path, operation string, oldValue, newValue interface{})

AddChange adds a change record to the history

type ConfigurationListItem

type ConfigurationListItem struct {
	ID          string              `json:"id"`
	Name        string              `json:"name"`
	Version     string              `json:"version"`
	Environment string              `json:"environment"`
	Status      ConfigurationStatus `json:"status"`
	Description string              `json:"description,omitempty"`
	UpdatedAt   time.Time           `json:"updated_at"`
	UpdatedBy   string              `json:"updated_by,omitempty"`
}

ConfigurationListItem represents a summary of a configuration for listing

type ConfigurationOverride

type ConfigurationOverride struct {
	ID              string                 `json:"id" bson:"_id,omitempty"`
	ConfigID        string                 `json:"config_id" bson:"config_id"`
	InstancePattern string                 `json:"instance_pattern" bson:"instance_pattern"`
	Environment     string                 `json:"environment" bson:"environment"`
	Overrides       map[string]interface{} `json:"overrides" bson:"overrides"`
	Description     string                 `json:"description,omitempty" bson:"description,omitempty"`
	Enabled         bool                   `json:"enabled" bson:"enabled"`
	CreatedBy       string                 `json:"created_by" bson:"created_by"`
	CreatedAt       time.Time              `json:"created_at" bson:"created_at"`
	UpdatedBy       string                 `json:"updated_by,omitempty" bson:"updated_by,omitempty"`
	UpdatedAt       time.Time              `json:"updated_at" bson:"updated_at"`
}

ConfigurationOverride represents instance-specific configuration overrides

type ConfigurationStatus

type ConfigurationStatus string

ConfigurationStatus represents the status of a configuration version

const (
	ConfigStatusDraft    ConfigurationStatus = "draft"
	ConfigStatusActive   ConfigurationStatus = "active"
	ConfigStatusArchived ConfigurationStatus = "archived"
)

type ConfigurationStore

type ConfigurationStore struct {
	// Unique identifier
	ID string `json:"id" bson:"_id,omitempty"`

	// Version identifier (semantic versioning recommended)
	Version string `json:"version" bson:"version"`

	// Environment this configuration applies to
	Environment string `json:"environment" bson:"environment"`

	// Status of this configuration version
	Status ConfigurationStatus `json:"status" bson:"status"`

	// Configuration name/type
	Name string `json:"name" bson:"name"`

	// Description of this version
	Description string `json:"description,omitempty" bson:"description,omitempty"`

	// The actual configuration data
	Data map[string]interface{} `json:"data" bson:"data"`

	// Schema version for migration support
	SchemaVersion int `json:"schema_version" bson:"schema_version"`

	// Instance pattern for targeted configurations (e.g., "app-*", "hub-1")
	InstancePattern string `json:"instance_pattern,omitempty" bson:"instance_pattern,omitempty"`

	// Tags for categorization
	Tags []string `json:"tags,omitempty" bson:"tags,omitempty"`

	// Audit information
	CreatedBy   string     `json:"created_by" bson:"created_by"`
	CreatedAt   time.Time  `json:"created_at" bson:"created_at"`
	UpdatedBy   string     `json:"updated_by,omitempty" bson:"updated_by,omitempty"`
	UpdatedAt   time.Time  `json:"updated_at" bson:"updated_at"`
	ActivatedBy string     `json:"activated_by,omitempty" bson:"activated_by,omitempty"`
	ActivatedAt *time.Time `json:"activated_at,omitempty" bson:"activated_at,omitempty"`

	// Previous version reference for rollback
	PreviousVersion string `json:"previous_version,omitempty" bson:"previous_version,omitempty"`

	// Checksum for integrity verification
	Checksum string `json:"checksum,omitempty" bson:"checksum,omitempty"`
}

ConfigurationStore represents a versioned configuration entry

func NewConfigurationStore

func NewConfigurationStore(name, version, environment, createdBy string, data map[string]interface{}) *ConfigurationStore

NewConfigurationStore creates a new configuration store entry

func (*ConfigurationStore) Activate

func (c *ConfigurationStore) Activate(activatedBy string)

Activate marks the configuration as active

func (*ConfigurationStore) Archive

func (c *ConfigurationStore) Archive(updatedBy string)

Archive marks the configuration as archived

func (*ConfigurationStore) GetValue

func (c *ConfigurationStore) GetValue(key string) (interface{}, bool)

GetValue retrieves a value from the configuration data by key path

func (*ConfigurationStore) IsActive

func (c *ConfigurationStore) IsActive() bool

IsActive returns true if the configuration is active

func (*ConfigurationStore) SetValue

func (c *ConfigurationStore) SetValue(key string, value interface{})

SetValue sets a value in the configuration data

func (*ConfigurationStore) ToListItem

func (c *ConfigurationStore) ToListItem() ConfigurationListItem

ToListItem converts a ConfigurationStore to a list item

type ContainerInfo

type ContainerInfo struct {
	ContainerID   string `json:"container_id,omitempty" bson:"container_id,omitempty"`
	ContainerName string `json:"container_name,omitempty" bson:"container_name,omitempty"`
	ImageName     string `json:"image_name,omitempty" bson:"image_name,omitempty"`
	ImageTag      string `json:"image_tag,omitempty" bson:"image_tag,omitempty"`

	// Kubernetes specific
	PodName      string            `json:"pod_name,omitempty" bson:"pod_name,omitempty"`
	PodNamespace string            `json:"pod_namespace,omitempty" bson:"pod_namespace,omitempty"`
	NodeName     string            `json:"node_name,omitempty" bson:"node_name,omitempty"`
	ServiceName  string            `json:"service_name,omitempty" bson:"service_name,omitempty"`
	Labels       map[string]string `json:"labels,omitempty" bson:"labels,omitempty"`
}

ContainerInfo holds container/Kubernetes specific information

type Conversation

type Conversation struct {
	ID               string `json:"id" gorm:"column:id;primaryKey;type:varchar(36);default:(UUID())"`
	Title            string `json:"title" gorm:"column:title;type:varchar(255);not null"`
	UserID           string `json:"userid" gorm:"column:userid;type:varchar(36);not null"`
	DatabaseAlias    string `json:"databasealias" gorm:"column:databasealias;type:varchar(100)"`
	AutoExecuteQuery bool   `json:"autoexecutequery" gorm:"column:autoexecutequery;default:true"`

	// Relationships
	Messages []ChatMessage `json:"messages,omitempty" gorm:"foreignKey:ConversationID;constraint:OnDelete:CASCADE"`

	// Standard IAC audit fields (must be at end)
	Active          bool         `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string       `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string       `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       sql.NullTime `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string       `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      sql.NullTime `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int          `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

Conversation represents a chat conversation thread

func (Conversation) TableName

func (Conversation) TableName() string

TableName specifies the table name

type DataSet

type DataSet struct {
	ID             string                 `json:"_id" bson:"_id"`
	Schema         string                 `json:"$schema" bson:"$schema"`
	Ref            string                 `json:"$ref" bson:"$ref"`
	Name           string                 `json:"name" bson:"name"`
	Version        string                 `json:"version" bson:"version"`
	IsDefault      bool                   `json:"isdefault" bson:"isdefault"`
	DataSourceType string                 `json:"datasourcetype" bson:"datasourcetype"`
	DataSource     string                 `json:"datasource" bson:"datasource"`
	ListFields     []string               `json:"listfields" bson:"listfields"`
	HiddenFields   []string               `json:"hiddenfields" bson:"hiddenfields"`
	KeyField       string                 `json:"keyfield" bson:"keyfield"`
	Query          string                 `json:"query,omitempty" bson:"query,omitempty"`
	DetailPage     map[string]interface{} `json:"detailpage" bson:"detailpage"`
	Definitions    map[string]interface{} `json:"definitions" bson:"definitions"`
	Description    string                 `json:"description,omitempty" bson:"description,omitempty"`
	Tags           []string               `json:"tags,omitempty" bson:"tags,omitempty"`

	// Dynamic root-level page nodes (simplepage, listpage, cardpage, etc.)
	// These are stored as a map to allow any custom page node names
	ExtraPages map[string]interface{} `json:"extrapages,omitempty" bson:"extrapages,omitempty"`

	// Packaging & deployment config — describes how data from this dataset is packaged and deployed
	PackagingConfig  *DatasetPackagingConfig  `json:"packaging_config,omitempty" bson:"packaging_config,omitempty"`
	DeploymentConfig *DatasetDeploymentConfig `json:"deployment_config,omitempty" bson:"deployment_config,omitempty"`

	// Audit Fields
	CreatedBy       string    `json:"createdby" bson:"createdby"`
	CreatedOn       time.Time `json:"createdon" bson:"createdon"`
	ModifiedBy      string    `json:"modifiedby" bson:"modifiedby"`
	ModifiedOn      time.Time `json:"modifiedon" bson:"modifiedon"`
	RowVersionStamp int       `json:"rowversionstamp" bson:"rowversionstamp"`
}

DataSet represents a dataset schema stored in the system

type DataSetCreateRequest

type DataSetCreateRequest struct {
	Schema         string                 `json:"$schema" binding:"required"`
	Ref            string                 `json:"$ref" binding:"required"`
	Name           string                 `json:"name" binding:"required"`
	Version        string                 `json:"version"`
	IsDefault      bool                   `json:"isdefault"`
	DataSourceType string                 `json:"datasourcetype" binding:"required"`
	DataSource     string                 `json:"datasource" binding:"required"`
	ListFields     []string               `json:"listfields"`
	HiddenFields   []string               `json:"hiddenfields"`
	KeyField       string                 `json:"keyfield" binding:"required"`
	Query          string                 `json:"query,omitempty"`
	DetailPage     map[string]interface{} `json:"detailpage"`
	Definitions    map[string]interface{} `json:"definitions"`
	Description    string                 `json:"description,omitempty"`
	Tags           []string               `json:"tags,omitempty"`
	ExtraPages     map[string]interface{} `json:"extrapages,omitempty"`
}

DataSetCreateRequest represents the request to create a new dataset

type DataSetListResponse

type DataSetListResponse struct {
	Data  []DataSet `json:"data"`
	Count int       `json:"count"`
}

DataSetListResponse represents the response for listing datasets

type DataSetUpdateRequest

type DataSetUpdateRequest struct {
	Schema         string                 `json:"$schema,omitempty"`
	Ref            string                 `json:"$ref,omitempty"`
	Name           string                 `json:"name,omitempty"`
	Version        string                 `json:"version,omitempty"`
	IsDefault      bool                   `json:"isdefault,omitempty"`
	DataSourceType string                 `json:"datasourcetype,omitempty"`
	DataSource     string                 `json:"datasource,omitempty"`
	ListFields     []string               `json:"listfields,omitempty"`
	HiddenFields   []string               `json:"hiddenfields,omitempty"`
	KeyField       string                 `json:"keyfield,omitempty"`
	Query          string                 `json:"query,omitempty"`
	DetailPage     map[string]interface{} `json:"detailpage,omitempty"`
	Definitions    map[string]interface{} `json:"definitions,omitempty"`
	Description    string                 `json:"description,omitempty"`
	Tags           []string               `json:"tags,omitempty"`
	ExtraPages     map[string]interface{} `json:"extrapages,omitempty"`
}

DataSetUpdateRequest represents the request to update an existing dataset

type DatabaseSchemaEmbedding

type DatabaseSchemaEmbedding struct {
	ID              int             `json:"id" gorm:"primaryKey"`
	UUID            string          `json:"uuid" gorm:"type:uuid;default:gen_random_uuid();uniqueIndex"`
	ReferenceID     *string         `json:"referenceid" gorm:"column:referenceid;uniqueIndex"`
	ConfigID        int             `json:"config_id" gorm:"column:config_id;not null"`
	DatabaseAlias   string          `json:"database_alias" gorm:"column:database_alias;not null"`
	SchemaName      string          `json:"schema_name" gorm:"column:schema_name;not null"`
	MappedTableName string          `json:"table_name" gorm:"column:table_name;not null"`
	ColumnName      *string         `json:"column_name" gorm:"column:column_name"`
	Description     string          `json:"description" gorm:"column:description"`
	Metadata        json.RawMessage `json:"metadata" gorm:"column:metadata;type:jsonb"`
	Embedding       Vector          `json:"embedding,omitempty" gorm:"column:embedding;type:vector"`
	EmbeddingHash   string          `json:"embedding_hash" gorm:"column:embedding_hash"`
	GeneratedAt     time.Time       `json:"generated_at" gorm:"column:generated_at"`
	Active          bool            `json:"active" gorm:"column:active;default:true"`
	CreatedBy       string          `json:"createdby" gorm:"column:createdby;not null"`
	CreatedOn       time.Time       `json:"createdon" gorm:"column:createdon;default:CURRENT_TIMESTAMP"`
	ModifiedBy      *string         `json:"modifiedby" gorm:"column:modifiedby"`
	ModifiedOn      *time.Time      `json:"modifiedon" gorm:"column:modifiedon"`
	RowVersionStamp int             `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

DatabaseSchemaEmbedding stores vector embeddings for database schema metadata (IAC Standard)

func (DatabaseSchemaEmbedding) TableName

func (DatabaseSchemaEmbedding) TableName() string

TableName specifies the table name for GORM

type DatabaseSchemaMetadata

type DatabaseSchemaMetadata struct {
	ID            string       `json:"id" gorm:"column:id;primaryKey;type:varchar(36);default:(UUID())"`
	DatabaseAlias string       `json:"database_alias" gorm:"column:databasealias;type:varchar(100);not null"`
	SchemaName    string       `json:"schema_name" gorm:"column:schemaname;type:varchar(100)"`
	Table         string       `json:"table_name" gorm:"column:tablename;type:varchar(100);not null"`
	Column        string       `json:"column_name" gorm:"column:columnname;type:varchar(100)"`
	DataType      string       `json:"data_type" gorm:"column:datatype;type:varchar(50)"`
	IsNullable    *bool        `json:"is_nullable" gorm:"column:isnullable"`
	IsPrimaryKey  *bool        `json:"is_primary_key" gorm:"column:is_primary_key"`
	IsForeignKey  *bool        `json:"is_foreign_key" gorm:"column:is_foreign_key"`
	ColumnComment string       `json:"column_comment" gorm:"column:columncomment;type:text"`
	SampleValues  JSONMap      `json:"sample_values" gorm:"column:samplevalues;type:json"`
	MetadataType  MetadataType `json:"entity_type" gorm:"column:metadatatype;type:enum('table','column');not null"`
	Description   string       `json:"description" gorm:"column:description;type:text"`
	BusinessName  string       `json:"business_name" gorm:"column:business_name;type:varchar(255)"`
	BusinessTerms JSONMap      `json:"business_terms" gorm:"column:businessterms;type:json"`

	// Standard IAC audit fields (must be at end)
	Active          bool         `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string       `json:"reference_id" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string       `json:"created_by" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       sql.NullTime `json:"created_at" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string       `json:"modified_by" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      sql.NullTime `json:"updated_at" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int          `json:"row_version_stamp" gorm:"column:rowversionstamp;default:1"`
}

DatabaseSchemaMetadata represents database schema information

func (DatabaseSchemaMetadata) TableName

func (DatabaseSchemaMetadata) TableName() string

TableName specifies the table name

type DatabaseSchemaMetadataSummary

type DatabaseSchemaMetadataSummary struct {
	DatabaseAlias           string     `json:"database_alias"`
	SchemaName              string     `json:"schema_name"`
	TableName               string     `json:"table_name"`
	HasTableDescription     int        `json:"has_table_description"`
	ColumnsWithDescriptions int        `json:"columns_with_descriptions"`
	LastUpdated             *time.Time `json:"last_updated"`
}

DatabaseSchemaMetadataSummary holds summary of database schema metadata

type DatasetDeploymentConfig

type DatasetDeploymentConfig struct {
	// If existing record (matched by global key) is found: update or skip
	UpdateExisting bool `json:"update_existing" bson:"update_existing"`
	SkipExisting   bool `json:"skip_existing" bson:"skip_existing"`
	// Validate FK/document references before deploying
	ValidateReferences bool `json:"validate_references" bson:"validate_references"`
	// Regenerate auto-increment PKs (false = preserve original PK where possible)
	RegeneratePK bool `json:"regenerate_pk" bson:"regenerate_pk"`
	// Batch size for INSERT operations
	BatchSize int `json:"batch_size,omitempty" bson:"batch_size,omitempty"`
}

DatasetDeploymentConfig defines deployment behaviour for data from this dataset

type DatasetPackagingConfig

type DatasetPackagingConfig struct {
	// Tables/collections explicitly included; empty = use DataSource
	Tables      []string `json:"tables,omitempty" bson:"tables,omitempty"`
	Collections []string `json:"collections,omitempty" bson:"collections,omitempty"`
	// Global key columns/fields for each table or collection (used for upsert matching)
	GlobalKeyColumns map[string][]string `json:"global_key_columns,omitempty" bson:"global_key_columns,omitempty"`
	// FK relations to follow when packaging: table -> list of FK column names (empty = follow all)
	SelectRelations map[string][]string `json:"select_relations,omitempty" bson:"select_relations,omitempty"`
	// FK relations NOT to follow
	ExcludeRelations map[string][]string `json:"exclude_relations,omitempty" bson:"exclude_relations,omitempty"`
	// Columns/fields to exclude per table/collection
	ExcludeColumns map[string][]string `json:"exclude_columns,omitempty" bson:"exclude_columns,omitempty"`
	// Whether to auto-include related parent records
	IncludeRelated bool `json:"include_related" bson:"include_related"`
	// Max traversal depth for FK relationships
	MaxDepth int `json:"max_depth,omitempty" bson:"max_depth,omitempty"`
}

DatasetPackagingConfig defines how a dataset participates in packaging

type DirectionNode

type DirectionNode struct {
	Direction  string `json:"direction"`
	InstanceID string `json:"instance_id"`
}

DirectionNode represents a direction node in the tree

type DistributedSession

type DistributedSession struct {
	SessionID string `json:"session_id" bson:"session_id"`
	UserID    string `json:"user_id" bson:"user_id"`
	Username  string `json:"username" bson:"username"`
	LoginName string `json:"login_name" bson:"login_name"`
	ClientID  string `json:"client_id" bson:"client_id"`

	// Token information
	TokenHash    string    `json:"token_hash" bson:"token_hash"`
	TokenExpiry  time.Time `json:"token_expiry" bson:"token_expiry"`
	RefreshToken string    `json:"refresh_token,omitempty" bson:"refresh_token,omitempty"`

	// Instance tracking
	CreatedInstance string `json:"created_instance" bson:"created_instance"`
	LastInstance    string `json:"last_instance" bson:"last_instance"`

	// User permissions and roles
	Roles       []string `json:"roles,omitempty" bson:"roles,omitempty"`
	Permissions []string `json:"permissions,omitempty" bson:"permissions,omitempty"`

	// Session data (arbitrary key-value storage)
	Data map[string]interface{} `json:"data,omitempty" bson:"data,omitempty"`

	// Timing
	CreatedAt      time.Time `json:"created_at" bson:"created_at"`
	LastAccessedAt time.Time `json:"last_accessed_at" bson:"last_accessed_at"`
	ExpiresAt      time.Time `json:"expires_at" bson:"expires_at"`

	// Client metadata
	UserAgent string `json:"user_agent,omitempty" bson:"user_agent,omitempty"`
	IPAddress string `json:"ip_address,omitempty" bson:"ip_address,omitempty"`
	Language  string `json:"language,omitempty" bson:"language,omitempty"`
	Timezone  string `json:"timezone,omitempty" bson:"timezone,omitempty"`
}

DistributedSession represents a session shareable across IAC instances

func NewDistributedSession

func NewDistributedSession(userID, username, loginName, clientID, instanceID string, ttl time.Duration) *DistributedSession

NewDistributedSession creates a new distributed session

func (*DistributedSession) Extend

func (s *DistributedSession) Extend(duration time.Duration)

Extend extends the session expiry time

func (*DistributedSession) ExtendToken

func (s *DistributedSession) ExtendToken(duration time.Duration)

ExtendToken extends the token expiry time

func (*DistributedSession) GetData

func (s *DistributedSession) GetData(key string) (interface{}, bool)

GetData retrieves a value from the session data

func (*DistributedSession) IsExpired

func (s *DistributedSession) IsExpired() bool

IsExpired checks if the session has expired

func (*DistributedSession) IsTokenExpired

func (s *DistributedSession) IsTokenExpired() bool

IsTokenExpired checks if the token has expired

func (*DistributedSession) SetData

func (s *DistributedSession) SetData(key string, value interface{})

SetData sets a key-value pair in the session data

func (*DistributedSession) ToUserInfo

func (s *DistributedSession) ToUserInfo() map[string]interface{}

ToUserInfo converts session to a map compatible with existing user info structure

func (*DistributedSession) UpdateLastAccess

func (s *DistributedSession) UpdateLastAccess(instanceID string)

UpdateLastAccess updates the last accessed time and instance

type Document

type Document struct {
	ID          string       `json:"_id" bson:"_id"`
	Name        string       `json:"name" bson:"name"`         // Original filename
	Type        DocumentType `json:"type" bson:"type"`         // Document type
	FilePath    string       `json:"filePath" bson:"filePath"` // Physical file path on server
	URL         string       `json:"url" bson:"url"`           // Relative URL (no server name)
	Size        int64        `json:"size" bson:"size"`         // File size in bytes
	MimeType    string       `json:"mimeType" bson:"mimeType"` // MIME type
	Description string       `json:"description,omitempty" bson:"description,omitempty"`
	Tags        []string     `json:"tags,omitempty" bson:"tags,omitempty"`

	// Audit Fields
	CreatedBy       string    `json:"createdby" bson:"createdby"`
	CreatedOn       time.Time `json:"createdon" bson:"createdon"`
	ModifiedBy      string    `json:"modifiedby" bson:"modifiedby"`
	ModifiedOn      time.Time `json:"modifiedon" bson:"modifiedon"`
	RowVersionStamp int       `json:"rowversionstamp" bson:"rowversionstamp"`
}

Document represents a stored document/file in the system

type DocumentCreateRequest

type DocumentCreateRequest struct {
	Name        string       `json:"name" binding:"required"`
	Type        DocumentType `json:"type" binding:"required"`
	FilePath    string       `json:"filePath" binding:"required"`
	URL         string       `json:"url" binding:"required"`
	Size        int64        `json:"size"`
	MimeType    string       `json:"mimeType"`
	Description string       `json:"description,omitempty"`
	Tags        []string     `json:"tags,omitempty"`
}

DocumentCreateRequest represents the request to create a new document record

type DocumentListResponse

type DocumentListResponse struct {
	Data  []Document `json:"data"`
	Count int        `json:"count"`
}

DocumentListResponse represents the response for listing documents

type DocumentType

type DocumentType string

DocumentType represents the type of document

const (
	DocumentTypeImage   DocumentType = "IMAGE"
	DocumentTypePDF     DocumentType = "PDF"
	DocumentTypeVideo   DocumentType = "VIDEO"
	DocumentTypeOffice  DocumentType = "OFFICE"
	DocumentTypeModel3D DocumentType = "MODEL3D"
	DocumentTypeOther   DocumentType = "OTHER"
)

type DocumentUpdateRequest

type DocumentUpdateRequest struct {
	Name        string   `json:"name,omitempty"`
	Description string   `json:"description,omitempty"`
	Tags        []string `json:"tags,omitempty"`
}

DocumentUpdateRequest represents the request to update an existing document

type EmbeddingConfigStats

type EmbeddingConfigStats struct {
	ID                           int        `json:"id"`
	UUID                         string     `json:"uuid"`
	ConfigName                   string     `json:"config_name"`
	EmbeddingModel               string     `json:"embedding_model"`
	EmbeddingDimensions          int        `json:"embedding_dimensions"`
	VectorDatabaseType           string     `json:"vector_database_type"`
	Active                       bool       `json:"active"`
	CreatedOn                    time.Time  `json:"createdon"`
	DatabasesWithEmbeddings      int        `json:"databases_with_embeddings"`
	TablesWithEmbeddings         int        `json:"tables_with_embeddings"`
	TotalSchemaEmbeddings        int        `json:"total_schema_embeddings"`
	BusinessEntitiesCount        int        `json:"business_entities_count"`
	QueryTemplatesCount          int        `json:"query_templates_count"`
	LastSchemaEmbeddingGenerated *time.Time `json:"last_schema_embedding_generated"`
	LastEntityGenerated          *time.Time `json:"last_entity_generated"`
	LastTemplateGenerated        *time.Time `json:"last_template_generated"`
}

EmbeddingConfigStats holds statistics for embedding configurations (IAC Standard)

type EmbeddingGenerationJob

type EmbeddingGenerationJob struct {
	ID              int        `json:"id" gorm:"primaryKey"`
	UUID            string     `json:"uuid" gorm:"type:uuid;default:gen_random_uuid();uniqueIndex"`
	ReferenceID     *string    `json:"referenceid" gorm:"uniqueIndex"`
	ConfigID        int        `json:"config_id" gorm:"not null"`
	JobType         string     `json:"job_type" gorm:"not null"`
	DatabaseAlias   *string    `json:"database_alias"`
	Status          string     `json:"status" gorm:"default:pending"`
	TotalItems      int        `json:"total_items"`
	ProcessedItems  int        `json:"processed_items" gorm:"default:0"`
	FailedItems     int        `json:"failed_items" gorm:"default:0"`
	ErrorMessage    *string    `json:"error_message"`
	StartedAt       *time.Time `json:"started_at"`
	CompletedAt     *time.Time `json:"completed_at"`
	Active          bool       `json:"active" gorm:"default:true"`
	CreatedBy       string     `json:"createdby" gorm:"not null"`
	CreatedOn       time.Time  `json:"createdon" gorm:"default:CURRENT_TIMESTAMP"`
	ModifiedBy      *string    `json:"modifiedby"`
	ModifiedOn      *time.Time `json:"modifiedon"`
	RowVersionStamp int        `json:"rowversionstamp" gorm:"default:1"`
}

EmbeddingGenerationJob tracks batch embedding generation (IAC Standard)

func (EmbeddingGenerationJob) TableName

func (EmbeddingGenerationJob) TableName() string

TableName specifies the table name for GORM

type EmbeddingSearchLog

type EmbeddingSearchLog struct {
	ID               int             `json:"id" gorm:"primaryKey"`
	UUID             string          `json:"uuid" gorm:"type:uuid;default:gen_random_uuid();uniqueIndex"`
	ReferenceID      *string         `json:"referenceid" gorm:"uniqueIndex"`
	ConfigID         int             `json:"config_id" gorm:"not null"`
	SearchType       string          `json:"search_type" gorm:"not null"`
	SearchQuery      string          `json:"search_query" gorm:"not null"`
	SearchVector     Vector          `json:"search_vector,omitempty" gorm:"type:vector"`
	ResultsCount     int             `json:"results_count"`
	TopResults       json.RawMessage `json:"top_results" gorm:"type:jsonb"`
	SearchDurationMs int             `json:"search_duration_ms"`
	UserFeedback     *string         `json:"user_feedback"`
	Active           bool            `json:"active" gorm:"default:true"`
	CreatedBy        string          `json:"createdby" gorm:"not null"`
	CreatedOn        time.Time       `json:"createdon" gorm:"default:CURRENT_TIMESTAMP"`
	ModifiedBy       *string         `json:"modifiedby"`
	ModifiedOn       *time.Time      `json:"modifiedon"`
	RowVersionStamp  int             `json:"rowversionstamp" gorm:"default:1"`
}

EmbeddingSearchLog logs vector similarity searches (IAC Standard)

func (EmbeddingSearchLog) TableName

func (EmbeddingSearchLog) TableName() string

TableName specifies the table name for GORM

type EndpointStat

type EndpointStat struct {
	Endpoint      string  `json:"endpoint"`
	TotalCalls    int64   `json:"total_calls"`
	AvgDurationMs float64 `json:"avg_duration_ms"`
	ErrorRate     float64 `json:"error_rate"`
}

EndpointStat represents statistics for a specific endpoint

type EntityType

type EntityType string

EntityType represents the type of entity for embeddings

const (
	EntityTypeTable          EntityType = "table"
	EntityTypeColumn         EntityType = "column"
	EntityTypeBusinessEntity EntityType = "business_entity"
	EntityTypeQueryTemplate  EntityType = "query_template"
)

type FieldMapping

type FieldMapping struct {
	SourcePath    string      `json:"source_path"`
	TargetPath    string      `json:"target_path"`
	DataType      string      `json:"data_type"`
	DefaultValue  interface{} `json:"default_value"`
	Required      bool        `json:"required"`
	TransformFunc string      `json:"transform_func"`
}

FieldMapping represents a field mapping for transformations Note: Using existing FieldMapping from datahub schema

type FieldMappings

type FieldMappings []FieldMapping

FieldMappings stores array of field mappings in JSONB

func (*FieldMappings) Scan

func (f *FieldMappings) Scan(value interface{}) error

Scan implements sql.Scanner interface for JSONB

func (FieldMappings) Value

func (f FieldMappings) Value() (driver.Value, error)

Value implements driver.Valuer interface for JSONB

type GatewayTaskDoc

type GatewayTaskDoc struct {
	ID        string `json:"_id"        bson:"_id"`
	GatewayID string `json:"gateway_id" bson:"gateway_id"`
	Status    string `json:"status"     bson:"status"`
	Input     string `json:"input"      bson:"input"`
	Output    string `json:"output"     bson:"output"`
	Error     string `json:"error"      bson:"error"`
	CreatedOn string `json:"createdon"  bson:"createdon"` // RFC 3339 string
	UpdatedOn string `json:"updatedon"  bson:"updatedon"` // RFC 3339 string
}

GatewayTaskDoc is the MongoDB document for a single A2A task execution. Status values follow the Google A2A spec: submitted | working | completed | failed | canceled.

type GenerationType

type GenerationType string

GenerationType represents the type of AI generation

const (
	GenerationTypeSQL       GenerationType = "sql"
	GenerationTypeReport    GenerationType = "report"
	GenerationTypeNarrative GenerationType = "narrative"
	GenerationTypeChart     GenerationType = "chart"
)

type HealthStatus

type HealthStatus struct {
	Overall    string                     `json:"overall" bson:"overall"` // healthy, unhealthy, degraded
	Components map[string]ComponentHealth `json:"components,omitempty" bson:"components,omitempty"`
	LastCheck  time.Time                  `json:"last_check" bson:"last_check"`
}

HealthStatus represents the health of an instance

type HierarchicalTreeNode

type HierarchicalTreeNode struct {
	ID       string                  `json:"id"`
	Type     string                  `json:"type"`
	Label    string                  `json:"label"`
	Icon     string                  `json:"icon"`
	Data     interface{}             `json:"data"`
	Children []*HierarchicalTreeNode `json:"children,omitempty"`
}

HierarchicalTreeNode represents a node in the hierarchical tree

type HubConfig

type HubConfig map[string]interface{}

HubConfig stores configuration data in JSONB

func (*HubConfig) Scan

func (h *HubConfig) Scan(value interface{}) error

Scan implements sql.Scanner interface for JSONB

func (HubConfig) Value

func (h HubConfig) Value() (driver.Value, error)

Value implements driver.Valuer interface for JSONB

type HubDirection

type HubDirection struct {
	Enabled        bool                     `json:"enabled" bson:"enabled"`
	ProtocolGroups []HubSimpleProtocolGroup `json:"protocol_groups" bson:"protocol_groups"`
}

HubDirection represents inbound or outbound configuration

type HubEndpoint

type HubEndpoint struct {
	ID               string      `json:"id" db:"id"`
	ProtocolGroupID  string      `json:"protocol_group_id" db:"protocol_group_id"`
	Name             string      `json:"name" db:"name"`
	Description      string      `json:"description" db:"description"`
	EndpointURL      string      `json:"endpoint_url" db:"endpoint_url"`
	Port             int         `json:"port" db:"port"`
	Path             string      `json:"path" db:"path"`
	Method           string      `json:"method" db:"method"`
	OverrideConfig   HubConfig   `json:"override_config" db:"override_config"`
	MessageType      string      `json:"message_type" db:"message_type"`
	Timeout          int         `json:"timeout" db:"timeout"`
	RetryAttempts    int         `json:"retry_attempts" db:"retry_attempts"`
	RetryInterval    int         `json:"retry_interval" db:"retry_interval"`
	AuthType         string      `json:"auth_type" db:"auth_type"`
	AuthConfig       HubConfig   `json:"auth_config" db:"auth_config"`
	QueueConfig      HubConfig   `json:"queue_config" db:"queue_config"`
	FileConfig       HubConfig   `json:"file_config" db:"file_config"`
	ValidateSchema   bool        `json:"validate_schema" db:"validate_schema"`
	SchemaDefinition string      `json:"schema_definition" db:"schema_definition"`
	Enabled          bool        `json:"enabled" db:"enabled"`
	Metadata         HubMetadata `json:"metadata" db:"metadata"`
	Active           bool        `json:"active" db:"active"`
	ReferenceID      string      `json:"referenceid" db:"referenceid"`
	CreatedBy        string      `json:"createdby" db:"createdby"`
	CreatedOn        time.Time   `json:"createdon" db:"createdon"`
	ModifiedBy       string      `json:"modifiedby" db:"modifiedby"`
	ModifiedOn       time.Time   `json:"modifiedon" db:"modifiedon"`
	RowVersionStamp  int         `json:"rowversionstamp" db:"rowversionstamp"`
}

HubEndpoint represents individual endpoint configuration

type HubEndpointJob

type HubEndpointJob struct {
	ID                 string      `json:"id" db:"id"`
	EndpointID         string      `json:"endpoint_id" db:"endpoint_id"`
	JobID              string      `json:"job_id" db:"job_id"`
	JobType            string      `json:"job_type" db:"job_type"`
	CronExpression     string      `json:"cron_expression" db:"cron_expression"`
	IntervalSeconds    int         `json:"interval_seconds" db:"interval_seconds"`
	TriggerEventType   string      `json:"trigger_event_type" db:"trigger_event_type"`
	TriggerEventSource string      `json:"trigger_event_source" db:"trigger_event_source"`
	TriggerEventFilter string      `json:"trigger_event_filter" db:"trigger_event_filter"`
	Timeout            int         `json:"timeout" db:"timeout"`
	MaxConcurrent      int         `json:"max_concurrent" db:"max_concurrent"`
	RetryOnFailure     bool        `json:"retry_on_failure" db:"retry_on_failure"`
	MaxRetries         int         `json:"max_retries" db:"max_retries"`
	Parameters         HubConfig   `json:"parameters" db:"parameters"`
	Enabled            bool        `json:"enabled" db:"enabled"`
	Metadata           HubMetadata `json:"metadata" db:"metadata"`
	Active             bool        `json:"active" db:"active"`
	ReferenceID        string      `json:"referenceid" db:"referenceid"`
	CreatedBy          string      `json:"createdby" db:"createdby"`
	CreatedOn          time.Time   `json:"createdon" db:"createdon"`
	ModifiedBy         string      `json:"modifiedby" db:"modifiedby"`
	ModifiedOn         time.Time   `json:"modifiedon" db:"modifiedon"`
	RowVersionStamp    int         `json:"rowversionstamp" db:"rowversionstamp"`
}

HubEndpointJob links jobs to specific endpoints

type HubInstance

type HubInstance struct {
	ID              string      `json:"id" db:"id"`
	InstanceID      string      `json:"instance_id" db:"instance_id"`
	Name            string      `json:"name" db:"name"`
	Description     string      `json:"description" db:"description"`
	Enabled         bool        `json:"enabled" db:"enabled"`
	Metadata        HubMetadata `json:"metadata" db:"metadata"`
	Active          bool        `json:"active" db:"active"`
	ReferenceID     string      `json:"referenceid" db:"referenceid"`
	CreatedBy       string      `json:"createdby" db:"createdby"`
	CreatedOn       time.Time   `json:"createdon" db:"createdon"`
	ModifiedBy      string      `json:"modifiedby" db:"modifiedby"`
	ModifiedOn      time.Time   `json:"modifiedon" db:"modifiedon"`
	RowVersionStamp int         `json:"rowversionstamp" db:"rowversionstamp"`
}

HubInstance represents a hub instance assignment

type HubMetadata

type HubMetadata map[string]interface{}

HubMetadata stores flexible metadata for hub entities

func (*HubMetadata) Scan

func (h *HubMetadata) Scan(value interface{}) error

Scan implements sql.Scanner interface for JSONB

func (HubMetadata) Value

func (h HubMetadata) Value() (driver.Value, error)

Value implements driver.Valuer interface for JSONB

type HubMigrationLog

type HubMigrationLog struct {
	ID               string      `json:"id" db:"id"`
	OldHubID         string      `json:"old_hub_id" db:"old_hub_id"`
	NewInstanceID    string      `json:"new_instance_id" db:"new_instance_id"`
	MigrationStatus  string      `json:"migration_status" db:"migration_status"`
	MigrationDetails HubMetadata `json:"migration_details" db:"migration_details"`
	ErrorMessage     string      `json:"error_message" db:"error_message"`
	MigratedAt       time.Time   `json:"migrated_at" db:"migrated_at"`
	CreatedBy        string      `json:"createdby" db:"createdby"`
	CreatedOn        time.Time   `json:"createdon" db:"createdon"`
}

HubMigrationLog tracks migration from old flat structure to hierarchical

type HubProtocolGroup

type HubProtocolGroup struct {
	ID              string      `json:"id" db:"id"`
	InstanceID      string      `json:"instance_id" db:"instance_id"`
	Direction       string      `json:"direction" db:"direction"`
	Name            string      `json:"name" db:"name"`
	Description     string      `json:"description" db:"description"`
	Protocol        string      `json:"protocol" db:"protocol"`
	BaseConfig      HubConfig   `json:"base_config" db:"base_config"`
	MessageType     string      `json:"message_type" db:"message_type"`
	Timeout         int         `json:"timeout" db:"timeout"`
	RetryAttempts   int         `json:"retry_attempts" db:"retry_attempts"`
	RetryInterval   int         `json:"retry_interval" db:"retry_interval"`
	AuthType        string      `json:"auth_type" db:"auth_type"`
	AuthConfig      HubConfig   `json:"auth_config" db:"auth_config"`
	Enabled         bool        `json:"enabled" db:"enabled"`
	Metadata        HubMetadata `json:"metadata" db:"metadata"`
	Active          bool        `json:"active" db:"active"`
	ReferenceID     string      `json:"referenceid" db:"referenceid"`
	CreatedBy       string      `json:"createdby" db:"createdby"`
	CreatedOn       time.Time   `json:"createdon" db:"createdon"`
	ModifiedBy      string      `json:"modifiedby" db:"modifiedby"`
	ModifiedOn      time.Time   `json:"modifiedon" db:"modifiedon"`
	RowVersionStamp int         `json:"rowversionstamp" db:"rowversionstamp"`
}

HubProtocolGroup represents protocol-level configuration group

type HubRoute

type HubRoute struct {
	ID                    string          `json:"id" db:"id"`
	SourceEndpointID      string          `json:"source_endpoint_id" db:"source_endpoint_id"`
	DestinationEndpointID string          `json:"destination_endpoint_id" db:"destination_endpoint_id"`
	Name                  string          `json:"name" db:"name"`
	Description           string          `json:"description" db:"description"`
	SourceFilter          string          `json:"source_filter" db:"source_filter"`
	Conditions            RouteConditions `json:"conditions" db:"conditions"`
	TransformationType    string          `json:"transformation_type" db:"transformation_type"`
	Transformation        string          `json:"transformation" db:"transformation"`
	FieldMappings         FieldMappings   `json:"field_mappings" db:"field_mappings"`
	Priority              int             `json:"priority" db:"priority"`
	AsyncMode             bool            `json:"async_mode" db:"async_mode"`
	OnError               string          `json:"on_error" db:"on_error"`
	DeadLetterQueue       string          `json:"dead_letter_queue" db:"dead_letter_queue"`
	MaxRetries            int             `json:"max_retries" db:"max_retries"`
	Enabled               bool            `json:"enabled" db:"enabled"`
	Metadata              HubMetadata     `json:"metadata" db:"metadata"`
	Active                bool            `json:"active" db:"active"`
	ReferenceID           string          `json:"referenceid" db:"referenceid"`
	CreatedBy             string          `json:"createdby" db:"createdby"`
	CreatedOn             time.Time       `json:"createdon" db:"createdon"`
	ModifiedBy            string          `json:"modifiedby" db:"modifiedby"`
	ModifiedOn            time.Time       `json:"modifiedon" db:"modifiedon"`
	RowVersionStamp       int             `json:"rowversionstamp" db:"rowversionstamp"`
}

HubRoute represents message routing configuration

type HubSimpleEndpoint

type HubSimpleEndpoint struct {
	ID          string `json:"id" bson:"id"`
	Name        string `json:"name" bson:"name"`
	Description string `json:"description" bson:"description"`

	// Endpoint Configuration
	EndpointURL string `json:"endpoint_url" bson:"endpoint_url"` // For outbound: external URL to call. For inbound webservice: leave empty (uses Path)
	Port        int    `json:"port" bson:"port"`
	Path        string `json:"path" bson:"path"`     // For inbound webservice: /api/receive/data. For outbound: appended to EndpointURL
	Method      string `json:"method" bson:"method"` // GET, POST, PUT, DELETE, etc.

	// Message Configuration
	MessageType      string `json:"message_type" bson:"message_type"` // JSON, XML, CSV, etc.
	ValidateSchema   bool   `json:"validate_schema" bson:"validate_schema"`
	SchemaDefinition string `json:"schema_definition" bson:"schema_definition"`

	// Connection Settings
	Timeout       int `json:"timeout" bson:"timeout"`
	RetryAttempts int `json:"retry_attempts" bson:"retry_attempts"`
	RetryInterval int `json:"retry_interval" bson:"retry_interval"`

	// Authentication
	AuthType   string                 `json:"auth_type" bson:"auth_type"`
	AuthConfig map[string]interface{} `json:"auth_config" bson:"auth_config"`

	// Additional Configuration
	OverrideConfig map[string]interface{} `json:"override_config" bson:"override_config"`
	QueueConfig    map[string]interface{} `json:"queue_config" bson:"queue_config"`
	FileConfig     map[string]interface{} `json:"file_config" bson:"file_config"`

	// Inbound Message Handler (for inbound endpoints only)
	Handler *MessageHandler `json:"handler,omitempty" bson:"handler,omitempty"`

	Enabled      bool                   `json:"enabled" bson:"enabled"`
	TrackHistory *bool                  `json:"track_history" bson:"track_history"` // Enable/disable history tracking (defaults to true if nil)
	Metadata     map[string]interface{} `json:"metadata" bson:"metadata"`
}

HubSimpleEndpoint represents an individual endpoint

func (*HubSimpleEndpoint) ShouldTrackHistory

func (e *HubSimpleEndpoint) ShouldTrackHistory() bool

ShouldTrackHistory returns true if history tracking is enabled for an endpoint Defaults to true if TrackHistory is nil

func (*HubSimpleEndpoint) UnmarshalBSONValue

func (e *HubSimpleEndpoint) UnmarshalBSONValue(t bsontype.Type, data []byte) error

UnmarshalBSONValue handles both string (legacy/ID only) and object formats for HubSimpleEndpoint in BSON

func (*HubSimpleEndpoint) UnmarshalJSON

func (e *HubSimpleEndpoint) UnmarshalJSON(data []byte) error

UnmarshalJSON handles both string (legacy/ID only) and object formats for HubSimpleEndpoint

type HubSimpleJob

type HubSimpleJob struct {
	ID                 string                 `json:"id" bson:"id"`
	Name               string                 `json:"name" bson:"name"`
	Description        string                 `json:"description" bson:"description"`
	JobType            string                 `json:"job_type" bson:"job_type"`
	EndpointRef        string                 `json:"endpoint_ref" bson:"endpoint_ref"`
	CronExpression     string                 `json:"cron_expression" bson:"cron_expression"`
	IntervalSeconds    int                    `json:"interval_seconds" bson:"interval_seconds"`
	TriggerEventType   string                 `json:"trigger_event_type" bson:"trigger_event_type"`
	TriggerEventSource string                 `json:"trigger_event_source" bson:"trigger_event_source"`
	TriggerEventFilter string                 `json:"trigger_event_filter" bson:"trigger_event_filter"`
	Timeout            int                    `json:"timeout" bson:"timeout"`
	MaxConcurrent      int                    `json:"max_concurrent" bson:"max_concurrent"`
	RetryOnFailure     bool                   `json:"retry_on_failure" bson:"retry_on_failure"`
	MaxRetries         int                    `json:"max_retries" bson:"max_retries"`
	Parameters         map[string]interface{} `json:"parameters" bson:"parameters"`
	Enabled            bool                   `json:"enabled" bson:"enabled"`
	Metadata           map[string]interface{} `json:"metadata" bson:"metadata"`
}

HubSimpleJob represents a scheduled job

type HubSimpleProtocolGroup

type HubSimpleProtocolGroup struct {
	ID            string                 `json:"id" bson:"id"`
	Name          string                 `json:"name" bson:"name"`
	Description   string                 `json:"description" bson:"description"`
	Protocol      string                 `json:"protocol" bson:"protocol"` // HTTP, HTTPS, REST, SOAP, MQTT, AMQP, Kafka, MCP, etc.
	MessageType   string                 `json:"message_type" bson:"message_type"`
	Timeout       int                    `json:"timeout" bson:"timeout"`
	RetryAttempts int                    `json:"retry_attempts" bson:"retry_attempts"`
	RetryInterval int                    `json:"retry_interval" bson:"retry_interval"`
	AuthType      string                 `json:"auth_type" bson:"auth_type"`
	AuthConfig    map[string]interface{} `json:"auth_config" bson:"auth_config"`
	BaseConfig    map[string]interface{} `json:"base_config" bson:"base_config"`

	// Message Bus Configuration (for MQTT, AMQP, Kafka, etc.)
	BrokerConfig *MessageBrokerConfig `json:"broker_config,omitempty" bson:"broker_config,omitempty"`

	// MCP Configuration (for Protocol == "MCP")
	MCPConfig *MCPProtocolConfig `json:"mcp_config,omitempty" bson:"mcp_config,omitempty"`

	Endpoints []HubSimpleEndpoint    `json:"endpoints" bson:"endpoints"`
	Enabled   bool                   `json:"enabled" bson:"enabled"`
	Metadata  map[string]interface{} `json:"metadata" bson:"metadata"`
}

HubSimpleProtocolGroup represents a protocol group with its endpoints

type HubSimpleRoute

type HubSimpleRoute struct {
	ID                 string                   `json:"id" bson:"id"`
	Name               string                   `json:"name" bson:"name"`
	Description        string                   `json:"description" bson:"description"`
	Source             string                   `json:"source" bson:"source"`
	SourceFilter       string                   `json:"source_filter" bson:"source_filter"`
	Destination        string                   `json:"destination" bson:"destination"`
	Conditions         []map[string]interface{} `json:"conditions" bson:"conditions"`
	TransformationType string                   `json:"transformation_type" bson:"transformation_type"`
	Transformation     string                   `json:"transformation" bson:"transformation"`
	FieldMappings      []map[string]interface{} `json:"field_mappings" bson:"field_mappings"`
	Priority           int                      `json:"priority" bson:"priority"`
	AsyncMode          bool                     `json:"async_mode" bson:"async_mode"`
	OnError            string                   `json:"on_error" bson:"on_error"`
	DeadLetterQueue    string                   `json:"dead_letter_queue" bson:"dead_letter_queue"`
	MaxRetries         int                      `json:"max_retries" bson:"max_retries"`
	Enabled            bool                     `json:"enabled" bson:"enabled"`
	Metadata           map[string]interface{}   `json:"metadata" bson:"metadata"`
}

HubSimpleRoute represents a message route

type InstanceAnnouncement

type InstanceAnnouncement struct {
	InstanceID   string            `json:"instance_id"`
	InstanceName string            `json:"instance_name"`
	Hostname     string            `json:"hostname"`
	IPAddress    string            `json:"ip_address"`
	Port         int               `json:"port"`
	Roles        []InstanceRole    `json:"roles"`
	Status       InstanceStatus    `json:"status"`
	Version      string            `json:"version"`
	Environment  string            `json:"environment"`
	StartTime    time.Time         `json:"start_time"`
	Timestamp    time.Time         `json:"timestamp"`
	Capacity     *InstanceCapacity `json:"capacity,omitempty"`
}

InstanceAnnouncement is a lightweight message for SignalR broadcasts

type InstanceCapacity

type InstanceCapacity struct {
	MaxConnections     int `json:"max_connections" bson:"max_connections"`
	MaxConcurrentJobs  int `json:"max_concurrent_jobs,omitempty" bson:"max_concurrent_jobs,omitempty"`
	MaxSessionsPerUser int `json:"max_sessions_per_user,omitempty" bson:"max_sessions_per_user,omitempty"`
	MemoryLimitMB      int `json:"memory_limit_mb,omitempty" bson:"memory_limit_mb,omitempty"`
	CPUCores           int `json:"cpu_cores,omitempty" bson:"cpu_cores,omitempty"`
}

InstanceCapacity represents the capacity configuration of an instance

type InstanceMetrics

type InstanceMetrics struct {
	ActiveConnections int       `json:"active_connections" bson:"active_connections"`
	ActiveSessions    int       `json:"active_sessions" bson:"active_sessions"`
	ActiveJobs        int       `json:"active_jobs,omitempty" bson:"active_jobs,omitempty"`
	RequestsPerSecond float64   `json:"requests_per_second,omitempty" bson:"requests_per_second,omitempty"`
	AvgResponseTimeMs float64   `json:"avg_response_time_ms,omitempty" bson:"avg_response_time_ms,omitempty"`
	MemoryUsedMB      int       `json:"memory_used_mb,omitempty" bson:"memory_used_mb,omitempty"`
	CPUUsagePercent   float64   `json:"cpu_usage_percent,omitempty" bson:"cpu_usage_percent,omitempty"`
	UptimeSeconds     int64     `json:"uptime_seconds" bson:"uptime_seconds"`
	CollectedAt       time.Time `json:"collected_at" bson:"collected_at"`
}

InstanceMetrics represents real-time metrics of an instance

type InstanceRegistry

type InstanceRegistry struct {
	// Instance identification
	InstanceID   string `json:"instance_id" bson:"instance_id"`
	InstanceName string `json:"instance_name" bson:"instance_name"`
	Hostname     string `json:"hostname" bson:"hostname"`
	IPAddress    string `json:"ip_address" bson:"ip_address"`
	Port         int    `json:"port" bson:"port"`

	// Instance roles and capabilities
	Roles        []InstanceRole `json:"roles" bson:"roles"`
	Capabilities []string       `json:"capabilities,omitempty" bson:"capabilities,omitempty"`

	// Status and health
	Status       InstanceStatus `json:"status" bson:"status"`
	HealthStatus *HealthStatus  `json:"health_status,omitempty" bson:"health_status,omitempty"`

	// Version information
	Version   string `json:"version" bson:"version"`
	BuildTime string `json:"build_time,omitempty" bson:"build_time,omitempty"`
	GitCommit string `json:"git_commit,omitempty" bson:"git_commit,omitempty"`

	// Environment
	Environment string `json:"environment" bson:"environment"`
	Region      string `json:"region,omitempty" bson:"region,omitempty"`
	Zone        string `json:"zone,omitempty" bson:"zone,omitempty"`

	// Container/Kubernetes metadata
	Container *ContainerInfo `json:"container,omitempty" bson:"container,omitempty"`

	// Capacity and metrics
	Capacity *InstanceCapacity `json:"capacity,omitempty" bson:"capacity,omitempty"`
	Metrics  *InstanceMetrics  `json:"metrics,omitempty" bson:"metrics,omitempty"`

	// Configuration
	ConfigVersion string                 `json:"config_version,omitempty" bson:"config_version,omitempty"`
	Settings      map[string]interface{} `json:"settings,omitempty" bson:"settings,omitempty"`

	// Timing
	StartTime        time.Time `json:"start_time" bson:"start_time"`
	RegisteredAt     time.Time `json:"registered_at" bson:"registered_at"`
	LastHeartbeat    time.Time `json:"last_heartbeat" bson:"last_heartbeat"`
	LastStatusChange time.Time `json:"last_status_change,omitempty" bson:"last_status_change,omitempty"`

	// SignalR connectivity
	SignalRConnected bool   `json:"signalr_connected" bson:"signalr_connected"`
	SignalRHubURL    string `json:"signalr_hub_url,omitempty" bson:"signalr_hub_url,omitempty"`
}

InstanceRegistry represents an IAC instance in the cluster registry

func NewInstanceRegistry

func NewInstanceRegistry(instanceID, instanceName, hostname, ipAddress string, port int) *InstanceRegistry

NewInstanceRegistry creates a new instance registry entry

func (*InstanceRegistry) AddRole

func (r *InstanceRegistry) AddRole(role InstanceRole)

AddRole adds a role to the instance

func (*InstanceRegistry) GetEndpoint

func (r *InstanceRegistry) GetEndpoint() string

GetEndpoint returns the HTTP endpoint URL for this instance

func (*InstanceRegistry) HasRole

func (r *InstanceRegistry) HasRole(role InstanceRole) bool

HasRole checks if the instance has a specific role

func (*InstanceRegistry) IsHealthy

func (r *InstanceRegistry) IsHealthy() bool

IsHealthy checks if the instance is considered healthy

func (*InstanceRegistry) IsStale

func (r *InstanceRegistry) IsStale(threshold time.Duration) bool

IsStale checks if the instance heartbeat is stale (no heartbeat within threshold)

func (*InstanceRegistry) SetStatus

func (r *InstanceRegistry) SetStatus(status InstanceStatus)

SetStatus updates the instance status

func (*InstanceRegistry) ToAnnouncement

func (r *InstanceRegistry) ToAnnouncement() *InstanceAnnouncement

ToAnnouncement converts the registry entry to a lightweight announcement

func (*InstanceRegistry) UpdateHealth

func (r *InstanceRegistry) UpdateHealth(health *HealthStatus)

UpdateHealth updates the health status

func (*InstanceRegistry) UpdateHeartbeat

func (r *InstanceRegistry) UpdateHeartbeat()

UpdateHeartbeat updates the heartbeat timestamp

func (*InstanceRegistry) UpdateMetrics

func (r *InstanceRegistry) UpdateMetrics(metrics *InstanceMetrics)

UpdateMetrics updates the instance metrics

type InstanceRole

type InstanceRole string

InstanceRole represents the role of an IAC instance

const (
	InstanceRoleApp            InstanceRole = "app"
	InstanceRoleIntegrationHub InstanceRole = "integration_hub"
	InstanceRoleSignalR        InstanceRole = "signalr"
	InstanceRoleJobExecutor    InstanceRole = "job_executor"
)

type InstanceStatus

type InstanceStatus string

InstanceStatus represents the current status of an IAC instance

const (
	InstanceStatusStarting    InstanceStatus = "starting"
	InstanceStatusRunning     InstanceStatus = "running"
	InstanceStatusDegraded    InstanceStatus = "degraded"
	InstanceStatusMaintenance InstanceStatus = "maintenance"
	InstanceStatusStopping    InstanceStatus = "stopping"
	InstanceStatusStopped     InstanceStatus = "stopped"
	InstanceStatusUnknown     InstanceStatus = "unknown"
)

type InstructionStatus

type InstructionStatus string

InstructionStatus represents the workflow status of a work instruction

const (
	StatusDraft    InstructionStatus = "DRAFT"
	StatusReview   InstructionStatus = "REVIEW"
	StatusReleased InstructionStatus = "RELEASED"
	StatusObsolete InstructionStatus = "OBSOLETE"
)

type IntHubActionHistory

type IntHubActionHistory struct {
	ID             string                 `json:"id" bson:"id" gorm:"column:id;primaryKey"`
	IntHubHisID    string                 `json:"int_hub_his_id" bson:"int_hub_his_id" gorm:"column:int_hub_his_id"`
	ActionSequence int                    `json:"action_sequence" bson:"action_sequence" gorm:"column:action_sequence"`
	ActionType     string                 `json:"action_type" bson:"action_type" gorm:"column:action_type"`
	ActionName     string                 `json:"action_name" bson:"action_name" gorm:"column:action_name"`
	ActionConfig   string                 `json:"action_config" bson:"action_config" gorm:"column:action_config"`
	InputData      string                 `json:"input_data" bson:"input_data" gorm:"column:input_data"`
	OutputData     string                 `json:"output_data" bson:"output_data" gorm:"column:output_data"`
	Status         IntHubActionStatus     `json:"status" bson:"status" gorm:"column:status"`
	ErrorMessage   string                 `json:"error_message" bson:"error_message" gorm:"column:error_message"`
	StartTime      time.Time              `json:"start_time" bson:"start_time" gorm:"column:start_time"`
	EndTime        *time.Time             `json:"end_time" bson:"end_time" gorm:"column:end_time"`
	DurationMs     int64                  `json:"duration_ms" bson:"duration_ms" gorm:"column:duration_ms"`
	Metadata       map[string]interface{} `json:"metadata" bson:"metadata" gorm:"column:metadata;serializer:json"`

	// IAC Standard Fields
	Active          bool      `json:"active" bson:"active" gorm:"column:active;default:true"`
	ReferenceID     string    `json:"referenceid" bson:"referenceid" gorm:"column:referenceid"`
	CreatedBy       string    `json:"createdby" bson:"createdby" gorm:"column:createdby"`
	CreatedOn       time.Time `json:"createdon" bson:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string    `json:"modifiedby" bson:"modifiedby" gorm:"column:modifiedby"`
	ModifiedOn      time.Time `json:"modifiedon" bson:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int       `json:"rowversionstamp" bson:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

IntHubActionHistory represents an individual action within a transaction

func (IntHubActionHistory) TableName

func (IntHubActionHistory) TableName() string

TableName returns the table name for GORM

type IntHubActionStatus

type IntHubActionStatus string

IntHubActionStatus represents the status of an action within a transaction

const (
	IntHubActionStatusPending    IntHubActionStatus = "pending"
	IntHubActionStatusProcessing IntHubActionStatus = "processing"
	IntHubActionStatusCompleted  IntHubActionStatus = "completed"
	IntHubActionStatusFailed     IntHubActionStatus = "failed"
	IntHubActionStatusSkipped    IntHubActionStatus = "skipped"
)

type IntHubEndpointStat

type IntHubEndpointStat struct {
	EndpointID   string  `json:"endpoint_id"`
	EndpointName string  `json:"endpoint_name"`
	Protocol     string  `json:"protocol"`
	TotalCount   int64   `json:"total_count"`
	AvgDuration  float64 `json:"avg_duration"`
	ErrorRate    float64 `json:"error_rate"`
}

IntHubEndpointStat represents statistics for a specific endpoint in integration hub

type IntHubHistory

type IntHubHistory struct {
	ID                string                 `json:"id" bson:"id" gorm:"column:id;primaryKey"`
	HubID             string                 `json:"hub_id" bson:"hub_id" gorm:"column:hub_id"`
	HubName           string                 `json:"hub_name" bson:"hub_name" gorm:"column:hub_name"`
	Direction         string                 `json:"direction" bson:"direction" gorm:"column:direction"`
	Protocol          string                 `json:"protocol" bson:"protocol" gorm:"column:protocol"`
	ProtocolGroupID   string                 `json:"protocol_group_id" bson:"protocol_group_id" gorm:"column:protocol_group_id"`
	ProtocolGroupName string                 `json:"protocol_group_name" bson:"protocol_group_name" gorm:"column:protocol_group_name"`
	EndpointID        string                 `json:"endpoint_id" bson:"endpoint_id" gorm:"column:endpoint_id"`
	EndpointName      string                 `json:"endpoint_name" bson:"endpoint_name" gorm:"column:endpoint_name"`
	Topic             string                 `json:"topic" bson:"topic" gorm:"column:topic"`
	Path              string                 `json:"path" bson:"path" gorm:"column:path"`
	Method            string                 `json:"method" bson:"method" gorm:"column:method"`
	Source            string                 `json:"source" bson:"source" gorm:"column:source"`
	Payload           string                 `json:"payload" bson:"payload" gorm:"column:payload"`
	PayloadSize       int                    `json:"payload_size" bson:"payload_size" gorm:"column:payload_size"`
	MessageType       string                 `json:"message_type" bson:"message_type" gorm:"column:message_type"`
	Action            string                 `json:"action" bson:"action" gorm:"column:action"`
	Status            IntHubHistoryStatus    `json:"status" bson:"status" gorm:"column:status"`
	ErrorMessage      string                 `json:"error_message" bson:"error_message" gorm:"column:error_message"`
	MappedData        string                 `json:"mapped_data" bson:"mapped_data" gorm:"column:mapped_data"`
	Response          string                 `json:"response" bson:"response" gorm:"column:response"`
	ResponseStatus    int                    `json:"response_status" bson:"response_status" gorm:"column:response_status"`
	StartTime         time.Time              `json:"start_time" bson:"start_time" gorm:"column:start_time"`
	EndTime           *time.Time             `json:"end_time" bson:"end_time" gorm:"column:end_time"`
	DurationMs        int64                  `json:"duration_ms" bson:"duration_ms" gorm:"column:duration_ms"`
	InstanceID        string                 `json:"instance_id" bson:"instance_id" gorm:"column:instance_id"`
	InstanceName      string                 `json:"instance_name" bson:"instance_name" gorm:"column:instance_name"`
	UserID            string                 `json:"user_id" bson:"user_id" gorm:"column:user_id"`
	ClientID          string                 `json:"client_id" bson:"client_id" gorm:"column:client_id"`
	Metadata          map[string]interface{} `json:"metadata" bson:"metadata" gorm:"column:metadata;serializer:json"`

	// IAC Standard Fields
	Active          bool      `json:"active" bson:"active" gorm:"column:active;default:true"`
	ReferenceID     string    `json:"referenceid" bson:"referenceid" gorm:"column:referenceid"`
	CreatedBy       string    `json:"createdby" bson:"createdby" gorm:"column:createdby"`
	CreatedOn       time.Time `json:"createdon" bson:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string    `json:"modifiedby" bson:"modifiedby" gorm:"column:modifiedby"`
	ModifiedOn      time.Time `json:"modifiedon" bson:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int       `json:"rowversionstamp" bson:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`

	// Related actions (not stored in DB, populated on demand)
	Actions []IntHubActionHistory `json:"actions,omitempty" bson:"-" gorm:"-"`
}

IntHubHistory represents a transaction history record for integration hub

func (IntHubHistory) TableName

func (IntHubHistory) TableName() string

TableName returns the table name for GORM

type IntHubHistoryListItem

type IntHubHistoryListItem struct {
	ID           string              `json:"id"`
	HubID        string              `json:"hub_id"`
	HubName      string              `json:"hub_name"`
	Direction    string              `json:"direction"`
	Protocol     string              `json:"protocol"`
	EndpointName string              `json:"endpoint_name"`
	Topic        string              `json:"topic"`
	Status       IntHubHistoryStatus `json:"status"`
	DurationMs   int64               `json:"duration_ms"`
	StartTime    time.Time           `json:"start_time"`
}

IntHubHistoryListItem represents a simplified history item for list views

type IntHubHistoryStats

type IntHubHistoryStats struct {
	TotalTransactions int64                 `json:"total_transactions"`
	CompletedCount    int64                 `json:"completed_count"`
	FailedCount       int64                 `json:"failed_count"`
	PendingCount      int64                 `json:"pending_count"`
	ProcessingCount   int64                 `json:"processing_count"`
	AverageDurationMs float64               `json:"average_duration_ms"`
	MinDurationMs     int64                 `json:"min_duration_ms"`
	MaxDurationMs     int64                 `json:"max_duration_ms"`
	ByProtocol        map[string]int64      `json:"by_protocol"`
	ByDirection       map[string]int64      `json:"by_direction"`
	ByStatus          map[string]int64      `json:"by_status"`
	TopEndpoints      []IntHubEndpointStat  `json:"top_endpoints"`
	TopTopics         []IntHubTopicStat     `json:"top_topics"`
	TimeRange         *IntHubTimeRangeStats `json:"time_range"`
}

IntHubHistoryStats represents statistics for integration hub history

type IntHubHistoryStatus

type IntHubHistoryStatus string

IntHubHistoryStatus represents the status of an integration hub transaction

const (
	IntHubHistoryStatusPending    IntHubHistoryStatus = "pending"
	IntHubHistoryStatusProcessing IntHubHistoryStatus = "processing"
	IntHubHistoryStatusCompleted  IntHubHistoryStatus = "completed"
	IntHubHistoryStatusFailed     IntHubHistoryStatus = "failed"
)

type IntHubTimeRangeStats

type IntHubTimeRangeStats struct {
	StartTime time.Time `json:"start_time"`
	EndTime   time.Time `json:"end_time"`
}

IntHubTimeRangeStats represents time range for integration hub statistics

type IntHubTopicStat

type IntHubTopicStat struct {
	Topic       string  `json:"topic"`
	Protocol    string  `json:"protocol"`
	TotalCount  int64   `json:"total_count"`
	AvgDuration float64 `json:"avg_duration"`
	ErrorRate   float64 `json:"error_rate"`
}

IntHubTopicStat represents statistics for a specific topic in integration hub

type IntegrationHub

type IntegrationHub struct {
	ID              string                 `json:"_id" bson:"_id"`
	Name            string                 `json:"name" bson:"name"` // Unique name for grouping versions
	Description     string                 `json:"description" bson:"description"`
	InstanceID      string                 `json:"instance_id" bson:"instance_id"`
	Version         int                    `json:"version" bson:"version"`       // Version number for this configuration
	IsDefault       bool                   `json:"is_default" bson:"is_default"` // Only one default per instance_name
	Status          IntegrationHubStatus   `json:"status" bson:"status"`         // dev, test, production, deprecated
	Enabled         bool                   `json:"enabled" bson:"enabled"`
	Inbound         *HubDirection          `json:"inbound" bson:"inbound"`
	Outbound        *HubDirection          `json:"outbound" bson:"outbound"`
	Routes          []HubSimpleRoute       `json:"routes" bson:"routes"`
	Jobs            []HubSimpleJob         `json:"jobs" bson:"jobs"`
	Metadata        map[string]interface{} `json:"metadata" bson:"metadata"`
	Active          bool                   `json:"active" bson:"active"`
	CreatedBy       string                 `json:"createdby" bson:"createdby"`
	CreatedOn       time.Time              `json:"createdon" bson:"createdon"`
	ModifiedBy      string                 `json:"modifiedby" bson:"modifiedby"`
	ModifiedOn      time.Time              `json:"modifiedon" bson:"modifiedon"`
	RowVersionStamp int                    `json:"rowversionstamp" bson:"rowversionstamp"`
}

IntegrationHub represents a complete integration hub configuration stored as a single document in the Integration_Hub collection

type IntegrationHubStatus

type IntegrationHubStatus string

IntegrationHubStatus represents the status of an integration hub configuration

const (
	IntegrationHubStatusDev        IntegrationHubStatus = "dev"
	IntegrationHubStatusTest       IntegrationHubStatus = "test"
	IntegrationHubStatusProduction IntegrationHubStatus = "production"
	IntegrationHubStatusDeprecated IntegrationHubStatus = "deprecated"
)

type JSONBMap

type JSONBMap map[string]string

JSONBMap is a JSONB-backed map[string]string for GORM

func (*JSONBMap) Scan

func (m *JSONBMap) Scan(value interface{}) error

func (JSONBMap) Value

func (m JSONBMap) Value() (driver.Value, error)

type JSONField

type JSONField struct {
	Data interface{}
}

JSONField is a flexible type for JSON fields that can hold arrays or objects

func (JSONField) MarshalJSON

func (j JSONField) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler for JSONField

func (*JSONField) Scan

func (j *JSONField) Scan(value interface{}) error

Scan implements the sql.Scanner interface for JSONField

func (*JSONField) UnmarshalJSON

func (j *JSONField) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler for JSONField

func (JSONField) Value

func (j JSONField) Value() (driver.Value, error)

Value implements the driver.Valuer interface for JSONField

type JSONMap

type JSONMap map[string]interface{}

JSONMap is a helper type for JSON fields

func (*JSONMap) Scan

func (j *JSONMap) Scan(value interface{}) error

Scan implements the sql.Scanner interface

func (JSONMap) Value

func (j JSONMap) Value() (driver.Value, error)

Value implements the driver.Valuer interface

type Job

type Job struct {
	ID              string      `json:"id" db:"id"`
	Name            string      `json:"name" db:"name"`                       // Job name
	Description     *string     `json:"description" db:"description"`         // Job description - nullable
	TypeID          int         `json:"typeid" db:"typeid"`                   // Job type
	Handler         string      `json:"handler" db:"handler"`                 // Transaction code or command to execute
	CronExpression  *string     `json:"cronexpression" db:"cronexpression"`   // Cron expression for scheduling - nullable
	IntervalSeconds *int        `json:"intervalseconds" db:"intervalseconds"` // Interval in seconds (alternative to cron) - nullable
	StartAt         *time.Time  `json:"startat" db:"startat"`                 // When to start execution
	EndAt           *time.Time  `json:"endat" db:"endat"`                     // When to stop execution
	MaxExecutions   int         `json:"maxexecutions" db:"maxexecutions"`     // Maximum number of executions (0 = unlimited)
	ExecutionCount  int         `json:"executioncount" db:"executioncount"`   // Current execution count
	Enabled         bool        `json:"enabled" db:"enabled"`                 // Whether job is enabled
	Condition       *string     `json:"condition" db:"condition"`             // SQL or expression to evaluate before execution - nullable
	Priority        int         `json:"priority" db:"priority"`               // Job priority
	MaxRetries      int         `json:"maxretries" db:"maxretries"`           // Maximum retry attempts for generated jobs
	Timeout         int         `json:"timeout" db:"timeout"`                 // Timeout in seconds
	Metadata        JobMetadata `json:"metadata" db:"metadata"`               // Additional configuration
	LastRunAt       *time.Time  `json:"lastRunAt" db:"lastRunAt"`             // Last execution time
	NextRunAt       *time.Time  `json:"nextRunAt" db:"nextRunAt"`             // Next scheduled execution time
	Active          bool        `json:"active" db:"active"`
	ReferenceID     *string     `json:"referenceid" db:"referenceid"` // nullable
	CreatedBy       *string     `json:"createdby" db:"createdby"`     // nullable
	CreatedOn       time.Time   `json:"createdon" db:"createdon"`
	ModifiedBy      *string     `json:"modifiedby" db:"modifiedby"` // nullable
	ModifiedOn      time.Time   `json:"modifiedon" db:"modifiedon"`
	RowVersionStamp int         `json:"rowversionstamp" db:"rowversionstamp"`
}

Job represents a scheduled/interval job configuration

type JobDirection

type JobDirection string

JobDirection represents the direction of message flow

const (
	JobDirectionInbound  JobDirection = "inbound"
	JobDirectionOutbound JobDirection = "outbound"
	JobDirectionInternal JobDirection = "internal"
)

type JobHistory

type JobHistory struct {
	ID              string      `json:"id" db:"id"`
	JobID           string      `json:"jobid" db:"jobid"`               // Reference to QueueJob
	ExecutionID     string      `json:"executionid" db:"executionid"`   // Unique execution identifier
	StatusID        int         `json:"statusid" db:"statusid"`         // Execution status
	StartedAt       time.Time   `json:"startedat" db:"startedat"`       // Execution start time
	CompletedAt     *time.Time  `json:"completedat" db:"completedat"`   // Execution completion time
	Duration        int64       `json:"duration" db:"duration"`         // Duration in milliseconds
	Result          string      `json:"result" db:"result"`             // Execution result
	ErrorMessage    string      `json:"errormessage" db:"errormessage"` // Error details if failed
	RetryAttempt    int         `json:"retryattempt" db:"retryattempt"` // Which retry attempt this was
	ExecutedBy      string      `json:"executedby" db:"executedby"`     // Worker/instance that executed
	InputData       string      `json:"inputdata" db:"inputdata"`       // Input data snapshot
	OutputData      string      `json:"outputdata" db:"outputdata"`     // Output data
	Metadata        JobMetadata `json:"metadata" db:"metadata"`         // Execution metadata
	Active          bool        `json:"active" db:"active"`
	ReferenceID     string      `json:"referenceid" db:"referenceid"`
	CreatedBy       string      `json:"createdby" db:"createdby"`
	CreatedOn       time.Time   `json:"createdon" db:"createdon"`
	ModifiedBy      string      `json:"modifiedby" db:"modifiedby"`
	ModifiedOn      time.Time   `json:"modifiedon" db:"modifiedon"`
	RowVersionStamp int         `json:"rowversionstamp" db:"rowversionstamp"`
}

JobHistory represents the execution history of jobs

type JobLock

type JobLock struct {
	JobID      string    `json:"jobid"`
	InstanceID string    `json:"instanceid"`
	LockedAt   time.Time `json:"lockedat"`
	ExpiresAt  time.Time `json:"expiresat"`
}

JobLock represents a distributed lock for job processing

type JobMetadata

type JobMetadata map[string]interface{}

JobMetadata stores flexible metadata for jobs

func (*JobMetadata) Scan

func (j *JobMetadata) Scan(value interface{}) error

Scan implements sql.Scanner interface

func (JobMetadata) Value

func (j JobMetadata) Value() (driver.Value, error)

Value implements driver.Valuer interface

type JobStatus

type JobStatus int

JobStatus represents the status of a job

const (
	JobStatusPending JobStatus = iota
	JobStatusQueued
	JobStatusProcessing
	JobStatusCompleted
	JobStatusFailed
	JobStatusRetrying
	JobStatusCancelled
	JobStatusScheduled
)

type JobType

type JobType int

JobType represents the type of job

const (
	JobTypeIntegration JobType = iota
	JobTypeScheduled
	JobTypeManual
	JobTypeSystem
	JobTypeAgent
)

type ListHistoryParams

type ListHistoryParams struct {
	Method     string    `json:"method"`
	Endpoint   string    `json:"endpoint"`
	StatusCode int       `json:"status_code"`
	UserID     string    `json:"user_id"`
	SourceIP   string    `json:"source_ip"`
	StartDate  time.Time `json:"start_date"`
	EndDate    time.Time `json:"end_date"`
	OnlyErrors bool      `json:"only_errors"`
	Page       int       `json:"page"`
	PageSize   int       `json:"page_size"`
}

ListHistoryParams represents parameters for listing history

type ListHistoryResponse

type ListHistoryResponse struct {
	History []APICallHistoryListItem `json:"history"`
	Total   int64                    `json:"total"`
	Page    int                      `json:"page"`
	Pages   int64                    `json:"pages"`
}

ListHistoryResponse represents the response for listing history

type ListIntHubHistoryParams

type ListIntHubHistoryParams struct {
	HubID      string              `json:"hub_id" form:"hub_id"`
	Direction  string              `json:"direction" form:"direction"`
	Protocol   string              `json:"protocol" form:"protocol"`
	EndpointID string              `json:"endpoint_id" form:"endpoint_id"`
	Topic      string              `json:"topic" form:"topic"`
	Status     IntHubHistoryStatus `json:"status" form:"status"`
	StartTime  time.Time           `json:"start_time" form:"start_time"`
	EndTime    time.Time           `json:"end_time" form:"end_time"`
	OnlyErrors bool                `json:"only_errors" form:"only_errors"`
	Page       int                 `json:"page" form:"page"`
	PageSize   int                 `json:"page_size" form:"page_size"`
}

ListIntHubHistoryParams represents parameters for listing history

type ListIntHubHistoryResponse

type ListIntHubHistoryResponse struct {
	History  []IntHubHistoryListItem `json:"history"`
	Total    int64                   `json:"total"`
	Page     int                     `json:"page"`
	PageSize int                     `json:"page_size"`
	Pages    int                     `json:"pages"`
}

ListIntHubHistoryResponse represents the response for listing history

type MCPProtocolConfig

type MCPProtocolConfig struct {
	ServerURL  string            `json:"server_url" bson:"server_url"`   // MCP server base URL (e.g. http://localhost:3000)
	MCPPath    string            `json:"mcp_path" bson:"mcp_path"`       // JSON-RPC endpoint path (default "/mcp")
	ToolName   string            `json:"tool_name" bson:"tool_name"`     // MCP tool to invoke
	Headers    map[string]string `json:"headers" bson:"headers"`         // Extra HTTP headers
	TimeoutSec int               `json:"timeout_sec" bson:"timeout_sec"` // Per-call timeout in seconds (default 30)
}

MCPProtocolConfig holds MCP server connection settings for Integration Hub protocol groups. Used when Protocol == "MCP" to route outbound messages to an MCP tool via JSON-RPC 2.0.

type MCPServer

type MCPServer struct {
	ID            string `json:"id"              gorm:"column:id;primaryKey;type:varchar(36)"`
	Name          string `json:"name"            gorm:"column:name;type:varchar(100);not null"`
	Description   string `json:"description"     gorm:"column:description;type:text"`
	TransportType string `json:"transporttype"   gorm:"column:transport_type;type:varchar(20);not null;default:'http'"`
	URL           string `json:"url"             gorm:"column:url;type:varchar(500)"`
	// MCPPath is the JSON-RPC 2.0 endpoint path (e.g. "/mcp"). Default "/mcp".
	MCPPath         string       `json:"mcppath"         gorm:"column:mcp_path;type:varchar(200);not null;default:'/mcp'"`
	Command         string       `json:"command"         gorm:"column:command;type:varchar(500)"`
	Args            StringSlice  `json:"args"            gorm:"column:args;type:jsonb;default:'[]'"`
	Headers         JSONBMap     `json:"headers"         gorm:"column:headers;type:jsonb;default:'{}'"`
	Enabled         bool         `json:"enabled"         gorm:"column:enabled;not null;default:true"`
	Active          bool         `json:"active"          gorm:"column:active;not null;default:true"`
	CreatedBy       string       `json:"createdby"       gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       sql.NullTime `json:"createdon"       gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string       `json:"modifiedby"      gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      sql.NullTime `json:"modifiedon"      gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int          `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

MCPServer represents a Model Context Protocol server configuration.

func MCPServerDocToModel

func MCPServerDocToModel(d *MCPServerDoc) *MCPServer

MCPServerDocToModel converts an MCPServerDoc to an MCPServer model.

func (MCPServer) TableName

func (MCPServer) TableName() string

type MCPServerDoc

type MCPServerDoc struct {
	ID              string            `json:"_id"             bson:"_id"`
	Name            string            `json:"name"            bson:"name"`
	Description     string            `json:"description"     bson:"description"`
	TransportType   string            `json:"transport_type"  bson:"transport_type"`
	URL             string            `json:"url"             bson:"url"`
	MCPPath         string            `json:"mcp_path"        bson:"mcp_path"`
	Command         string            `json:"command"         bson:"command"`
	Args            []string          `json:"args"            bson:"args"`
	Headers         map[string]string `json:"headers"         bson:"headers"`
	Enabled         bool              `json:"enabled"         bson:"enabled"`
	Active          bool              `json:"active"          bson:"active"`
	CreatedBy       string            `json:"createdby"       bson:"createdby"`
	CreatedOn       time.Time         `json:"createdon"       bson:"createdon"`
	ModifiedBy      string            `json:"modifiedby"      bson:"modifiedby"`
	ModifiedOn      time.Time         `json:"modifiedon"      bson:"modifiedon"`
	RowVersionStamp int               `json:"rowversionstamp" bson:"rowversionstamp"`
}

MCPServerDoc is the MongoDB document representation of an MCP server.

func MCPServerModelToDoc

func MCPServerModelToDoc(m *MCPServer) *MCPServerDoc

MCPServerModelToDoc converts a GORM MCPServer to an MCPServerDoc for MongoDB storage.

type MediaType

type MediaType string

MediaType represents the type of media attachment

const (
	MediaImage   MediaType = "IMAGE"
	MediaPDF     MediaType = "PDF"
	MediaVideo   MediaType = "VIDEO"
	MediaOffice  MediaType = "OFFICE"
	MediaModel3D MediaType = "MODEL3D"
	MediaOther   MediaType = "OTHER"
)

type MessageBrokerConfig

type MessageBrokerConfig struct {
	BrokerURL        string                 `json:"broker_url" bson:"broker_url"`   // e.g., mqtt://broker.example.com:1883
	BrokerHost       string                 `json:"broker_host" bson:"broker_host"` // e.g., broker.example.com
	BrokerPort       int                    `json:"broker_port" bson:"broker_port"` // e.g., 1883, 5672, 9092
	Topics           []BrokerTopic          `json:"topics" bson:"topics"`           // Topics/queues to subscribe to (inbound) or publish to (outbound)
	Username         string                 `json:"username,omitempty" bson:"username,omitempty"`
	Password         string                 `json:"password,omitempty" bson:"password,omitempty"`
	ClientID         string                 `json:"client_id,omitempty" bson:"client_id,omitempty"`
	UseTLS           bool                   `json:"use_tls" bson:"use_tls"`
	TLSConfig        map[string]interface{} `json:"tls_config,omitempty" bson:"tls_config,omitempty"`         // Certificate paths, etc.
	QoS              int                    `json:"qos,omitempty" bson:"qos,omitempty"`                       // Quality of Service (MQTT)
	ConsumerGroup    string                 `json:"consumer_group,omitempty" bson:"consumer_group,omitempty"` // Kafka consumer group
	AutoCommit       bool                   `json:"auto_commit" bson:"auto_commit"`                           // Kafka auto-commit
	MaxRetries       int                    `json:"max_retries" bson:"max_retries"`
	RetryInterval    int                    `json:"retry_interval" bson:"retry_interval"`             // Milliseconds
	KeepAlive        int                    `json:"keep_alive,omitempty" bson:"keep_alive,omitempty"` // Keep-alive interval in seconds
	AdditionalConfig map[string]interface{} `json:"additional_config,omitempty" bson:"additional_config,omitempty"`
}

MessageBrokerConfig represents message broker connection settings

type MessageHandler

type MessageHandler struct {
	HandlerType     string                 `json:"handler_type" bson:"handler_type"`                             // route, store, transform, script, webhook
	RouteIDs        []string               `json:"route_ids,omitempty" bson:"route_ids,omitempty"`               // References to HubSimpleRoute IDs
	StorageTarget   string                 `json:"storage_target,omitempty" bson:"storage_target,omitempty"`     // Database table/collection name
	TransformScript string                 `json:"transform_script,omitempty" bson:"transform_script,omitempty"` // Transformation logic
	WebhookURL      string                 `json:"webhook_url,omitempty" bson:"webhook_url,omitempty"`           // Webhook to call after processing
	OnSuccess       string                 `json:"on_success,omitempty" bson:"on_success,omitempty"`             // Action on success: ack, forward, store
	OnFailure       string                 `json:"on_failure,omitempty" bson:"on_failure,omitempty"`             // Action on failure: retry, dlq, ignore
	MaxRetries      int                    `json:"max_retries" bson:"max_retries"`
	DeadLetterQueue string                 `json:"dead_letter_queue,omitempty" bson:"dead_letter_queue,omitempty"`
	Parameters      map[string]interface{} `json:"parameters,omitempty" bson:"parameters,omitempty"` // Additional handler-specific params
}

MessageHandler defines how to process received messages (for inbound endpoints)

type MessageType

type MessageType string

MessageType represents the type of chat message

const (
	MessageTypeUser      MessageType = "user"
	MessageTypeAssistant MessageType = "assistant"
)

type MetadataType

type MetadataType string

MetadataType represents the type of schema metadata

const (
	MetadataTypeTable  MetadataType = "table"
	MetadataTypeColumn MetadataType = "column"
)

type MonitorChannelIDKey

type MonitorChannelIDKey struct{}

type MonitorChannelNameKey

type MonitorChannelNameKey struct{}

type MonitorChannelTypeKey

type MonitorChannelTypeKey struct{}

type MonitorSenderIDKey

type MonitorSenderIDKey struct{}

type MonitorSenderNameKey

type MonitorSenderNameKey struct{}

type MonitorSessionStatus

type MonitorSessionStatus struct {
	ChannelID   string `json:"channel_id"`
	ChannelName string `json:"channel_name"`
	ChannelType string `json:"channel_type"`
	AgentID     string `json:"agent_id"`
	AgentName   string `json:"agent_name"`
	SenderID    string `json:"sender_id"`
	SenderName  string `json:"sender_name"`
	ConvID      string `json:"conversation_id"`
	// Status: "idle" | "processing" | "error"
	Status         string    `json:"status"`
	LastMessageAt  time.Time `json:"last_message_at"`
	MessageCount   int       `json:"message_count"`
	StartedAt      time.Time `json:"started_at"`
	LastResponseMs int64     `json:"last_response_ms"`
}

MonitorSessionStatus represents the live state of one channel-user session as tracked by AgentMonitorService.

type MonitorStatus

type MonitorStatus struct {
	TotalChannels      int                    `json:"total_channels"`
	ActiveChannels     int                    `json:"active_channels"`
	TotalSessions      int                    `json:"total_sessions"`
	ProcessingSessions int                    `json:"processing_sessions"`
	TotalMessages      int64                  `json:"total_messages"`
	ChannelStats       []*ChannelMessageStats `json:"channel_stats"`
	UptimeSecs         int64                  `json:"uptime_secs"`
}

MonitorStatus is the top-level payload returned by GET /api/agentmonitor/status.

type NullableTime

type NullableTime struct {
	sql.NullTime
}

NullableTime is a custom nullable time type that can handle both []uint8 and time.Time scanning

func (NullableTime) MarshalJSON

func (nt NullableTime) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*NullableTime) Scan

func (nt *NullableTime) Scan(value interface{}) error

Scan implements the sql.Scanner interface

func (*NullableTime) UnmarshalJSON

func (nt *NullableTime) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

func (NullableTime) Value

func (nt NullableTime) Value() (driver.Value, error)

Value implements the driver.Valuer interface

type ParameterType

type ParameterType string

ParameterType represents the type of report parameter

const (
	ParameterTypeText        ParameterType = "text"
	ParameterTypeNumber      ParameterType = "number"
	ParameterTypeDate        ParameterType = "date"
	ParameterTypeDateTime    ParameterType = "datetime"
	ParameterTypeSelect      ParameterType = "select"
	ParameterTypeMultiSelect ParameterType = "multi_select"
	ParameterTypeBoolean     ParameterType = "boolean"
)

type PlanSchedulerProfile

type PlanSchedulerProfile struct {
	ID          string `json:"id" db:"id" gorm:"column:id;primaryKey;type:varchar(36)"`
	Name        string `json:"name" db:"name" gorm:"column:name;type:varchar(200);not null"`
	Description string `json:"description,omitempty" db:"description" gorm:"column:description;type:text"`
	IsDefault   bool   `json:"isDefault" db:"is_default" gorm:"column:is_default;default:false"`

	// Standard IAC 7 moderate fields
	Active          bool      `json:"active" db:"active" gorm:"column:active;default:true"`
	ReferenceID     string    `json:"referenceId,omitempty" db:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string    `json:"createdBy,omitempty" db:"createdby" gorm:"column:createdby;type:varchar(100)"`
	CreatedOn       time.Time `json:"createdOn" db:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string    `json:"modifiedBy,omitempty" db:"modifiedby" gorm:"column:modifiedby;type:varchar(100)"`
	ModifiedOn      time.Time `json:"modifiedOn" db:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int64     `json:"rowVersionStamp" db:"rowversionstamp" gorm:"column:rowversionstamp;default:0"`

	// Related data (loaded separately)
	DataSources []PlanSchedulerProfileDataSource `json:"dataSources,omitempty" gorm:"foreignKey:ProfileID;references:ID"`
	Constraints []PlanSchedulerProfileConstraint `json:"constraints,omitempty" gorm:"foreignKey:ProfileID;references:ID"`
	Settings    []PlanSchedulerProfileSetting    `json:"settings,omitempty" gorm:"foreignKey:ProfileID;references:ID"`
}

PlanSchedulerProfile represents a plan scheduler profile

func (PlanSchedulerProfile) TableName

func (PlanSchedulerProfile) TableName() string

TableName specifies the table name for GORM

type PlanSchedulerProfileConstraint

type PlanSchedulerProfileConstraint struct {
	ID             string          `json:"id" db:"id" gorm:"column:id;primaryKey;type:varchar(36)"`
	ProfileID      string          `json:"profileId" db:"profile_id" gorm:"column:profile_id;type:varchar(36);not null"`
	ConstraintType string          `json:"constraintType" db:"constraint_type" gorm:"column:constraint_type;type:varchar(50);not null"` // 'time', 'resource', 'dependency', 'custom'
	Name           string          `json:"name" db:"name" gorm:"column:name;type:varchar(200);not null"`
	Description    string          `json:"description,omitempty" db:"description" gorm:"column:description;type:text"`
	SourceType     string          `json:"sourceType" db:"source_type" gorm:"column:source_type;type:varchar(20);not null"` // 'query' or 'json'
	SourceQuery    string          `json:"sourceQuery,omitempty" db:"source_query" gorm:"column:source_query;type:text"`
	SourceJSON     json.RawMessage `json:"sourceJson,omitempty" db:"source_json" gorm:"column:source_json;type:jsonb"`
	Enforcement    string          `json:"enforcement" db:"enforcement" gorm:"column:enforcement;type:varchar(20);default:'hard'"` // 'hard', 'soft', 'advisory'
	DisplayOrder   int             `json:"displayOrder" db:"display_order" gorm:"column:display_order;default:0"`

	// Standard IAC 7 moderate fields
	Active          bool      `json:"active" db:"active" gorm:"column:active;default:true"`
	ReferenceID     string    `json:"referenceId,omitempty" db:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string    `json:"createdBy,omitempty" db:"createdby" gorm:"column:createdby;type:varchar(100)"`
	CreatedOn       time.Time `json:"createdOn" db:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string    `json:"modifiedBy,omitempty" db:"modifiedby" gorm:"column:modifiedby;type:varchar(100)"`
	ModifiedOn      time.Time `json:"modifiedOn" db:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int64     `json:"rowVersionStamp" db:"rowversionstamp" gorm:"column:rowversionstamp;default:0"`
}

PlanSchedulerProfileConstraint represents a scheduling constraint

func (PlanSchedulerProfileConstraint) TableName

TableName specifies the table name for GORM

type PlanSchedulerProfileData

type PlanSchedulerProfileData struct {
	ProfileID   string                              `json:"profileId"`
	ProfileName string                              `json:"profileName"`
	Tasks       []map[string]interface{}            `json:"tasks,omitempty"`
	Resources   []map[string]interface{}            `json:"resources,omitempty"`
	MasterData  map[string][]map[string]interface{} `json:"masterData,omitempty"`
	Constraints map[string]interface{}              `json:"constraints,omitempty"`
	Settings    map[string]interface{}              `json:"settings,omitempty"`
}

PlanSchedulerProfileData represents the loaded data from a profile

type PlanSchedulerProfileDataSource

type PlanSchedulerProfileDataSource struct {
	ID           string          `json:"id" db:"id" gorm:"column:id;primaryKey;type:varchar(36)"`
	ProfileID    string          `json:"profileId" db:"profile_id" gorm:"column:profile_id;type:varchar(36);not null"`
	DataType     string          `json:"dataType" db:"data_type" gorm:"column:data_type;type:varchar(50);not null"` // 'tasks', 'resources', 'materials', 'equipment', 'custom'
	Name         string          `json:"name" db:"name" gorm:"column:name;type:varchar(200);not null"`
	Description  string          `json:"description,omitempty" db:"description" gorm:"column:description;type:text"`
	SourceType   string          `json:"sourceType" db:"source_type" gorm:"column:source_type;type:varchar(20);not null"` // 'query' or 'json'
	SourceQuery  string          `json:"sourceQuery,omitempty" db:"source_query" gorm:"column:source_query;type:text"`
	SourceJSON   json.RawMessage `json:"sourceJson,omitempty" db:"source_json" gorm:"column:source_json;type:jsonb"`
	Parameters   json.RawMessage `json:"parameters,omitempty" db:"parameters" gorm:"column:parameters;type:jsonb"`
	DisplayOrder int             `json:"displayOrder" db:"display_order" gorm:"column:display_order;default:0"`

	// Standard IAC 7 moderate fields
	Active          bool      `json:"active" db:"active" gorm:"column:active;default:true"`
	ReferenceID     string    `json:"referenceId,omitempty" db:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string    `json:"createdBy,omitempty" db:"createdby" gorm:"column:createdby;type:varchar(100)"`
	CreatedOn       time.Time `json:"createdOn" db:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string    `json:"modifiedBy,omitempty" db:"modifiedby" gorm:"column:modifiedby;type:varchar(100)"`
	ModifiedOn      time.Time `json:"modifiedOn" db:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int64     `json:"rowVersionStamp" db:"rowversionstamp" gorm:"column:rowversionstamp;default:0"`
}

PlanSchedulerProfileDataSource represents a data source configuration

func (PlanSchedulerProfileDataSource) TableName

TableName specifies the table name for GORM

type PlanSchedulerProfileSetting

type PlanSchedulerProfileSetting struct {
	ID           string          `json:"id" db:"id" gorm:"column:id;primaryKey;type:varchar(36)"`
	ProfileID    string          `json:"profileId" db:"profile_id" gorm:"column:profile_id;type:varchar(36);not null"`
	SettingKey   string          `json:"settingKey" db:"setting_key" gorm:"column:setting_key;type:varchar(100);not null"`
	SettingValue json.RawMessage `json:"settingValue,omitempty" db:"setting_value" gorm:"column:setting_value;type:jsonb"`
	Description  string          `json:"description,omitempty" db:"description" gorm:"column:description;type:text"`

	// Standard IAC 7 moderate fields
	Active          bool      `json:"active" db:"active" gorm:"column:active;default:true"`
	ReferenceID     string    `json:"referenceId,omitempty" db:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string    `json:"createdBy,omitempty" db:"createdby" gorm:"column:createdby;type:varchar(100)"`
	CreatedOn       time.Time `json:"createdOn" db:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string    `json:"modifiedBy,omitempty" db:"modifiedby" gorm:"column:modifiedby;type:varchar(100)"`
	ModifiedOn      time.Time `json:"modifiedOn" db:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int64     `json:"rowVersionStamp" db:"rowversionstamp" gorm:"column:rowversionstamp;default:0"`
}

PlanSchedulerProfileSetting represents a profile setting

func (PlanSchedulerProfileSetting) TableName

func (PlanSchedulerProfileSetting) TableName() string

TableName specifies the table name for GORM

type PlanSchedulerSession

type PlanSchedulerSession struct {
	ID          string `json:"id" db:"id" gorm:"column:id;primaryKey;type:varchar(36)"`
	ProfileID   string `json:"profileId" db:"profile_id" gorm:"column:profile_id;type:varchar(36);not null"`
	SessionID   string `json:"sessionId" db:"session_id" gorm:"column:session_id;type:varchar(100);not null"`
	SessionName string `json:"sessionName,omitempty" db:"session_name" gorm:"column:session_name;type:varchar(200)"`
	Description string `json:"description,omitempty" db:"description" gorm:"column:description;type:text"`

	// Saved schedule data
	TasksData     json.RawMessage `json:"tasksData,omitempty" db:"tasks_data" gorm:"column:tasks_data;type:jsonb"`
	ResourcesData json.RawMessage `json:"resourcesData,omitempty" db:"resources_data" gorm:"column:resources_data;type:jsonb"`
	Metadata      json.RawMessage `json:"metadata,omitempty" db:"metadata" gorm:"column:metadata;type:jsonb"`

	// Session status
	Status    string `json:"status" db:"status" gorm:"column:status;type:varchar(20);default:'draft'"` // 'draft', 'active', 'archived'
	IsDefault bool   `json:"isDefault" db:"is_default" gorm:"column:is_default;default:false"`

	// Standard IAC 7 moderate fields
	Active          bool      `json:"active" db:"active" gorm:"column:active;default:true"`
	ReferenceID     string    `json:"referenceId,omitempty" db:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string    `json:"createdBy,omitempty" db:"createdby" gorm:"column:createdby;type:varchar(100)"`
	CreatedOn       time.Time `json:"createdOn" db:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string    `json:"modifiedBy,omitempty" db:"modifiedby" gorm:"column:modifiedby;type:varchar(100)"`
	ModifiedOn      time.Time `json:"modifiedOn" db:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int64     `json:"rowVersionStamp" db:"rowversionstamp" gorm:"column:rowversionstamp;default:0"`
}

PlanSchedulerSession represents a saved plan/schedule session

func (PlanSchedulerSession) TableName

func (PlanSchedulerSession) TableName() string

TableName specifies the table name for GORM

type PlantModel

type PlantModel struct {
	ID          string `json:"_id" bson:"_id"`
	Name        string `json:"name" bson:"name"`
	Description string `json:"description" bson:"description"`
	Version     string `json:"version" bson:"version"`

	// Plant Configuration
	Objects       []map[string]interface{} `json:"objects" bson:"objects"`       // 3D objects in the plant
	TourPoints    []map[string]interface{} `json:"tourPoints" bson:"tourPoints"` // Camera tour points
	FloorSettings map[string]interface{}   `json:"floorSettings" bson:"floorSettings"`
	GridSettings  map[string]interface{}   `json:"gridSettings" bson:"gridSettings"`

	// Simulation Settings
	SimulationSettings map[string]interface{} `json:"simulationSettings,omitempty" bson:"simulationSettings,omitempty"`

	// Workspace Settings
	WorkspaceSettings map[string]interface{} `json:"workspaceSettings,omitempty" bson:"workspaceSettings,omitempty"`

	// Metadata
	Tags      []string `json:"tags" bson:"tags"`
	Category  string   `json:"category" bson:"category"`
	Thumbnail string   `json:"thumbnail,omitempty" bson:"thumbnail,omitempty"`

	// Status
	Active    bool `json:"active" bson:"active"`
	Published bool `json:"published" bson:"published"`

	// Audit Fields
	CreatedBy       string    `json:"createdby" bson:"createdby"`
	CreatedOn       time.Time `json:"createdon" bson:"createdon"`
	ModifiedBy      string    `json:"modifiedby" bson:"modifiedby"`
	ModifiedOn      time.Time `json:"modifiedon" bson:"modifiedon"`
	RowVersionStamp int       `json:"rowversionstamp" bson:"rowversionstamp"`
}

PlantModel represents a plant configuration/layout

type PlantModelAsset

type PlantModelAsset struct {
	ID          string `json:"_id" bson:"_id"`
	Name        string `json:"name" bson:"name"`
	Description string `json:"description" bson:"description"`
	AssetType   string `json:"assetType" bson:"assetType"` // MACHINE_CNC, ROBOT_ARM, CONVEYOR, etc.

	// Asset Geometry
	PrimitiveParts []map[string]interface{} `json:"primitiveParts" bson:"primitiveParts"` // Primitive shapes that make up the asset
	BoundingBox    map[string]interface{}   `json:"boundingBox,omitempty" bson:"boundingBox,omitempty"`
	DefaultScale   []float64                `json:"defaultScale,omitempty" bson:"defaultScale,omitempty"`

	// Asset Configuration
	MetricConfigs []map[string]interface{} `json:"metricConfigs,omitempty" bson:"metricConfigs,omitempty"` // Configurable metrics
	ActionConfigs []map[string]interface{} `json:"actionConfigs,omitempty" bson:"actionConfigs,omitempty"` // Actions the asset can perform
	DefaultColor  string                   `json:"defaultColor,omitempty" bson:"defaultColor,omitempty"`

	// Metadata
	Tags      []string `json:"tags" bson:"tags"`
	Category  string   `json:"category" bson:"category"`
	Thumbnail string   `json:"thumbnail,omitempty" bson:"thumbnail,omitempty"`

	// Status
	Active    bool `json:"active" bson:"active"`
	Published bool `json:"published" bson:"published"`

	// Audit Fields
	CreatedBy       string    `json:"createdby" bson:"createdby"`
	CreatedOn       time.Time `json:"createdon" bson:"createdon"`
	ModifiedBy      string    `json:"modifiedby" bson:"modifiedby"`
	ModifiedOn      time.Time `json:"modifiedon" bson:"modifiedon"`
	RowVersionStamp int       `json:"rowversionstamp" bson:"rowversionstamp"`
}

PlantModelAsset represents reusable 3D assets

type PlantModelAssetListResponse

type PlantModelAssetListResponse struct {
	Data  []PlantModelAsset `json:"data"`
	Count int               `json:"count"`
}

PlantModelAssetListResponse represents API response for listing plant assets

type PlantModelListResponse

type PlantModelListResponse struct {
	Data  []PlantModel `json:"data"`
	Count int          `json:"count"`
}

PlantModelListResponse represents API response for listing plant models

type QueryTemplate

type QueryTemplate struct {
	ID                    int          `json:"id" gorm:"column:id;primaryKey;autoIncrement"`
	UUID                  string       `json:"uuid" gorm:"column:uuid;type:uuid;not null;uniqueIndex"`
	ReferenceID           string       `json:"referenceid" gorm:"column:referenceid;type:varchar(255);uniqueIndex"`
	ConfigID              int          `json:"config_id" gorm:"column:config_id;not null"`
	TemplateName          string       `json:"template_name" gorm:"column:template_name;type:varchar(255);not null"`
	TemplateCategory      string       `json:"template_category" gorm:"column:template_category;type:varchar(100)"`
	NaturalLanguageQuery  string       `json:"natural_language_query" gorm:"column:natural_language_query;type:text;not null"`
	SQLTemplate           string       `json:"sql_template" gorm:"column:sql_template;type:text;not null"`
	Parameters            JSONMap      `json:"parameters" gorm:"column:parameters;type:jsonb"`
	DatabaseAlias         string       `json:"database_alias" gorm:"column:database_alias;type:varchar(255)"`
	EntitiesUsed          JSONMap      `json:"entities_used" gorm:"column:entities_used;type:jsonb"`
	ExampleQueries        JSONMap      `json:"example_queries" gorm:"column:example_queries;type:jsonb"`
	ExpectedResultsSchema JSONMap      `json:"expected_results_schema" gorm:"column:expected_results_schema;type:jsonb"`
	UsageCount            int          `json:"usage_count" gorm:"column:usage_count;default:0"`
	LastUsedAt            sql.NullTime `json:"last_used_at" gorm:"column:last_used_at"`
	Embedding             VectorArray  `json:"embedding,omitempty" gorm:"column:embedding;type:vector"`
	EmbeddingHash         string       `json:"embedding_hash" gorm:"column:embedding_hash;type:varchar(64)"`
	GeneratedAt           sql.NullTime `json:"generated_at" gorm:"column:generated_at;default:CURRENT_TIMESTAMP"`

	// Standard IAC audit fields
	Active          bool         `json:"active" gorm:"column:active;default:true"`
	CreatedBy       string       `json:"createdby" gorm:"column:createdby;type:varchar(255);not null"`
	CreatedOn       sql.NullTime `json:"createdon" gorm:"column:createdon;default:CURRENT_TIMESTAMP"`
	ModifiedBy      string       `json:"modifiedby" gorm:"column:modifiedby;type:varchar(255)"`
	ModifiedOn      sql.NullTime `json:"modifiedon" gorm:"column:modifiedon"`
	RowVersionStamp int          `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

QueryTemplate represents reusable query patterns

func (QueryTemplate) TableName

func (QueryTemplate) TableName() string

TableName specifies the table name

type QueryTemplateRequest

type QueryTemplateRequest struct {
	ConfigID              int                    `json:"config_id" binding:"required"`
	TemplateName          string                 `json:"template_name" binding:"required" gorm:"column:template_name"`
	TemplateCategory      string                 `json:"template_category" gorm:"column:template_category"`
	NaturalLanguageQuery  string                 `json:"natural_language_query" binding:"required" gorm:"column:natural_language_query"`
	SQLTemplate           string                 `json:"sql_template" binding:"required"`
	Parameters            map[string]interface{} `json:"parameters"`
	DatabaseAlias         *string                `json:"database_alias"`
	EntitiesUsed          []string               `json:"entities_used"`
	ExampleQueries        []string               `json:"example_queries"`
	ExpectedResultsSchema map[string]interface{} `json:"expected_results_schema"`
}

QueryTemplateRequest represents request to create/update query template

type QueueJob

type QueueJob struct {
	ID              string       `json:"id" db:"id"`
	TypeID          int          `json:"typeid" db:"typeid"`
	Method          string       `json:"method" db:"method"`
	Protocol        string       `json:"protocol" db:"protocol"`
	Direction       JobDirection `json:"direction" db:"direction"`
	Handler         string       `json:"handler" db:"handler"`         // Transaction code or command to execute
	Metadata        JobMetadata  `json:"metadata" db:"metadata"`       // Flexible metadata storage
	Payload         string       `json:"payload" db:"payload"`         // Job payload/data
	Result          string       `json:"result" db:"result"`           // Execution result
	StatusID        int          `json:"statusid" db:"statusid"`       // Job status
	Priority        int          `json:"priority" db:"priority"`       // Higher number = higher priority
	MaxRetries      int          `json:"maxretries" db:"maxretries"`   // Maximum retry attempts
	RetryCount      int          `json:"retrycount" db:"retrycount"`   // Current retry count
	ScheduledAt     *time.Time   `json:"scheduledat" db:"scheduledat"` // When to execute (null = immediate)
	StartedAt       *time.Time   `json:"startedat" db:"startedat"`     // When execution started
	CompletedAt     *time.Time   `json:"completedat" db:"completedat"` // When execution completed
	LastError       string       `json:"lasterror" db:"lasterror"`     // Last error message
	ParentJobID     string       `json:"parentjobid" db:"parentjobid"` // Parent job for chained jobs
	Active          bool         `json:"active" db:"active"`
	ReferenceID     string       `json:"referenceid" db:"referenceid"`
	CreatedBy       string       `json:"createdby" db:"createdby"`
	CreatedOn       time.Time    `json:"createdon" db:"createdon"`
	ModifiedBy      string       `json:"modifiedby" db:"modifiedby"`
	ModifiedOn      time.Time    `json:"modifiedon" db:"modifiedon"`
	RowVersionStamp int          `json:"rowversionstamp" db:"rowversionstamp"`
}

QueueJob represents a job in the queue to be executed

type Report

type Report struct {
	ID               string     `json:"id" gorm:"primaryKey;column:id;type:varchar(36);default:(UUID())"`
	Name             string     `json:"name" gorm:"column:name;type:varchar(255);not null"`
	Description      string     `json:"description" gorm:"column:description;type:text"`
	ReportType       ReportType `json:"reporttype" gorm:"column:reporttype;type:enum('manual','ai_generated','template');default:'manual'"`
	IsPublic         bool       `json:"ispublic" gorm:"column:ispublic;default:false"`
	IsTemplate       bool       `json:"istemplate" gorm:"column:istemplate;default:false"`
	LayoutConfig     JSONMap    `json:"layoutconfig" gorm:"column:layoutconfig;type:json"`
	PageSettings     JSONMap    `json:"pagesettings" gorm:"column:pagesettings;type:json"`
	AIPrompt         string     `json:"aiprompt" gorm:"column:aiprompt;type:text"`
	AIAnalysis       JSONMap    `json:"aianalysis" gorm:"column:aianalysis;type:json"`
	TemplateSourceID string     `json:"templatesourceid" gorm:"column:templatesourceid;type:varchar(36)"`
	Tags             JSONMap    `json:"tags" gorm:"column:tags;type:json"`
	Version          int        `json:"version" gorm:"column:version;default:1"`
	LastExecutedOn   *time.Time `json:"lastexecutedon" gorm:"column:lastexecutedon"`

	// Relationships
	Datasources []ReportDatasource `json:"datasources,omitempty" gorm:"foreignKey:ReportID;constraint:OnDelete:CASCADE"`
	Components  []ReportComponent  `json:"components,omitempty" gorm:"foreignKey:ReportID;constraint:OnDelete:CASCADE"`
	Parameters  []ReportParameter  `json:"parameters,omitempty" gorm:"foreignKey:ReportID;constraint:OnDelete:CASCADE"`
	Executions  []ReportExecution  `json:"executions,omitempty" gorm:"foreignKey:ReportID;constraint:OnDelete:CASCADE"`
	Shares      []ReportShare      `json:"shares,omitempty" gorm:"foreignKey:ReportID;constraint:OnDelete:CASCADE"`

	// Standard IAC audit fields (must be at end)
	Active          bool   `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       Time   `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      Time   `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int    `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

Report represents a report definition

func (Report) TableName

func (Report) TableName() string

TableName specifies the table name

type ReportComponent

type ReportComponent struct {
	ID                    string        `json:"id" gorm:"primaryKey;column:id;type:varchar(36);default:(UUID())"`
	ReportID              string        `json:"reportid" gorm:"column:reportid;type:varchar(36);not null"`
	ComponentType         ComponentType `` /* 176-byte string literal not displayed */
	Name                  string        `json:"name" gorm:"column:name;type:varchar(255);not null"`
	X                     float64       `json:"x" gorm:"column:x;type:decimal(10,2);default:0"`
	Y                     float64       `json:"y" gorm:"column:y;type:decimal(10,2);default:0"`
	Width                 float64       `json:"width" gorm:"column:width;type:decimal(10,2);default:200"`
	Height                float64       `json:"height" gorm:"column:height;type:decimal(10,2);default:100"`
	ZIndex                int           `json:"zindex" gorm:"column:zindex;default:0"`
	DatasourceAlias       string        `json:"datasourcealias" gorm:"column:datasourcealias;type:varchar(100)"`
	DataConfig            JSONField     `json:"dataconfig" gorm:"column:dataconfig;type:json"`
	ComponentConfig       JSONField     `json:"componentconfig" gorm:"column:componentconfig;type:json"`
	StyleConfig           JSONField     `json:"styleconfig" gorm:"column:styleconfig;type:json"`
	ChartType             *ChartType    `` /* 152-byte string literal not displayed */
	ChartConfig           JSONField     `json:"chartconfig" gorm:"column:chartconfig;type:json"`
	BarcodeType           *BarcodeType  `` /* 136-byte string literal not displayed */
	BarcodeConfig         JSONField     `json:"barcodeconfig" gorm:"column:barcodeconfig;type:json"`
	DrillDownConfig       JSONField     `json:"drilldownconfig" gorm:"column:drilldownconfig;type:json"`
	PageBreakConfig       JSONField     `json:"pagebreakconfig" gorm:"column:pagebreakconfig;type:json"`
	PageHeaderConfig      JSONField     `json:"pageheaderconfig" gorm:"column:pageheaderconfig;type:json"`
	PageFooterConfig      JSONField     `json:"pagefooterconfig" gorm:"column:pagefooterconfig;type:json"`
	ConditionalFormatting JSONField     `json:"conditionalformatting" gorm:"column:conditionalformatting;type:json"`
	IsVisible             bool          `json:"isvisible" gorm:"column:isvisible;default:true"`

	// Standard IAC audit fields (must be at end)
	Active          bool   `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       Time   `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      Time   `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int    `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

ReportComponent represents a visual component in a report

func (ReportComponent) TableName

func (ReportComponent) TableName() string

TableName specifies the table name

type ReportDatasource

type ReportDatasource struct {
	ID             string    `json:"id" gorm:"primaryKey;type:varchar(36);default:(UUID())"`
	ReportID       string    `json:"reportid" gorm:"column:reportid;type:varchar(36);not null"`
	Alias          string    `json:"alias" gorm:"column:alias;type:varchar(100);not null"`
	DatabaseAlias  string    `json:"databasealias" gorm:"column:databasealias;type:varchar(100)"`
	QueryType      string    `json:"querytype" gorm:"column:querytype;type:varchar(20);default:'visual'"`
	CustomSQL      string    `json:"customsql" gorm:"column:customsql;type:text"`
	SelectedTables JSONField `json:"selectedtables" gorm:"column:selectedtables;type:json"`
	SelectedFields JSONField `json:"selectedfields" gorm:"column:selectedfields;type:json"`
	Joins          JSONField `json:"joins" gorm:"column:joins;type:json"`
	Filters        JSONField `json:"filters" gorm:"column:filters;type:json"`
	Sorting        JSONField `json:"sorting" gorm:"column:sorting;type:json"`
	Grouping       JSONField `json:"grouping" gorm:"column:grouping;type:json"`
	Parameters     JSONField `json:"parameters" gorm:"column:parameters;type:json"`

	// Standard IAC audit fields (must be at end)
	Active          bool   `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       Time   `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      Time   `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int    `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

ReportDatasource represents a data source for a report

func (ReportDatasource) TableName

func (ReportDatasource) TableName() string

TableName specifies the table name

type ReportExecution

type ReportExecution struct {
	ID              string  `json:"id" gorm:"primaryKey;column:id;type:varchar(36);default:(UUID())"`
	ReportID        string  `json:"reportid" gorm:"column:reportid;type:varchar(36);not null"`
	ExecutedBy      string  `json:"executedby" gorm:"column:executedby;type:varchar(36)"`
	ExecutionStatus string  `json:"executionstatus" gorm:"column:executionstatus;type:varchar(20);default:'pending'"`
	ExecutionTimeMs int     `json:"executiontimems" gorm:"column:executiontimems"`
	ErrorMessage    string  `json:"errormessage" gorm:"column:errormessage;type:text"`
	Parameters      JSONMap `json:"parameters" gorm:"column:parameters;type:json"`
	OutputFormat    string  `json:"outputformat" gorm:"column:outputformat;type:varchar(20)"`
	OutputSizeBytes int64   `json:"outputsizebytes" gorm:"column:outputsizebytes"`
	OutputPath      string  `json:"outputpath" gorm:"column:outputpath;type:varchar(500)"`
	RowCount        int     `json:"rowcount" gorm:"column:rowcount"`

	// Standard IAC audit fields (must be at end)
	Active          bool   `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       Time   `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      Time   `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int    `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

ReportExecution represents a report execution record

func (ReportExecution) TableName

func (ReportExecution) TableName() string

TableName specifies the table name

type ReportParameter

type ReportParameter struct {
	ID              string        `json:"id" gorm:"primaryKey;column:id;type:varchar(36);default:(UUID())"`
	ReportID        string        `json:"reportid" gorm:"column:reportid;type:varchar(36);not null"`
	Name            string        `json:"name" gorm:"column:name;type:varchar(100);not null"`
	DisplayName     string        `json:"displayname" gorm:"column:displayname;type:varchar(100)"`
	ParameterType   ParameterType `` /* 142-byte string literal not displayed */
	DefaultValue    string        `json:"defaultvalue" gorm:"column:defaultvalue;type:text"`
	IsRequired      bool          `json:"isrequired" gorm:"column:isrequired;default:false"`
	IsEnabled       bool          `json:"isenabled" gorm:"column:isenabled;default:true"`
	ValidationRules string        `json:"validationrules" gorm:"column:validationrules;type:text"`
	Options         string        `json:"options" gorm:"column:options;type:text"`
	Description     string        `json:"description" gorm:"column:description;type:text"`
	SortOrder       int           `json:"sortorder" gorm:"column:sortorder;default:0"`

	// Standard IAC audit fields (must be at end)
	Active          bool   `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       Time   `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      Time   `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int    `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

ReportParameter represents an input parameter for a report

func (ReportParameter) TableName

func (ReportParameter) TableName() string

TableName specifies the table name

type ReportSchedule

type ReportSchedule struct {
	ID             string     `json:"id" gorm:"primaryKey;column:id;type:varchar(36);default:(UUID())"`
	ReportID       string     `json:"reportid" gorm:"column:reportid;type:varchar(36);not null"`
	ScheduleName   string     `json:"schedulename" gorm:"column:schedulename;type:varchar(255)"`
	CronExpression string     `json:"cronexpression" gorm:"column:cronexpression;type:varchar(100);not null"`
	Timezone       string     `json:"timezone" gorm:"column:timezone;type:varchar(50);default:'UTC'"`
	OutputFormat   string     `json:"outputformat" gorm:"column:outputformat;type:varchar(20);default:'pdf'"`
	DeliveryMethod string     `json:"deliverymethod" gorm:"column:deliverymethod;type:varchar(20);default:'email'"`
	DeliveryConfig JSONMap    `json:"deliveryconfig" gorm:"column:deliveryconfig;type:json"`
	Parameters     JSONMap    `json:"parameters" gorm:"column:parameters;type:json"`
	LastRunAt      *time.Time `json:"lastrunat" gorm:"column:lastrunat"`
	NextRunAt      *time.Time `json:"nextrunat" gorm:"column:nextrunat"`

	// Standard IAC audit fields (must be at end)
	Active          bool   `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       Time   `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      Time   `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int    `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

ReportSchedule represents a scheduled report execution

func (ReportSchedule) TableName

func (ReportSchedule) TableName() string

TableName specifies the table name

type ReportShare

type ReportShare struct {
	ID         string     `json:"id" gorm:"primaryKey;column:id;type:varchar(36);default:(UUID())"`
	ReportID   string     `json:"reportid" gorm:"column:reportid;type:varchar(36);not null"`
	SharedBy   string     `json:"sharedby" gorm:"column:sharedby;type:varchar(36)"`
	SharedWith string     `json:"sharedwith" gorm:"column:sharedwith;type:varchar(36)"`
	CanView    bool       `json:"canview" gorm:"column:canview;default:true"`
	CanEdit    bool       `json:"canedit" gorm:"column:canedit;default:false"`
	CanExecute bool       `json:"canexecute" gorm:"column:canexecute;default:true"`
	CanShare   bool       `json:"canshare" gorm:"column:canshare;default:false"`
	ShareToken string     `json:"sharetoken" gorm:"column:sharetoken;type:varchar(255);uniqueIndex"`
	ExpiresAt  *time.Time `json:"expiresat" gorm:"column:expiresat"`

	// Standard IAC audit fields (must be at end)
	Active          bool   `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       Time   `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      Time   `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int    `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

ReportShare represents report sharing permissions

func (ReportShare) TableName

func (ReportShare) TableName() string

TableName specifies the table name

type ReportTemplate

type ReportTemplate struct {
	ID                string  `json:"id" gorm:"primaryKey;column:id;type:varchar(36);default:(UUID())"`
	Name              string  `json:"name" gorm:"column:name;type:varchar(255);not null"`
	Description       string  `json:"description" gorm:"column:description;type:text"`
	Category          string  `json:"category" gorm:"column:category;type:varchar(100)"`
	TemplateConfig    JSONMap `json:"templateconfig" gorm:"column:templateconfig;type:json"`
	PreviewImage      string  `json:"previewimage" gorm:"column:previewimage;type:varchar(500)"`
	UsageCount        int     `json:"usagecount" gorm:"column:usagecount;default:0"`
	Rating            float64 `json:"rating" gorm:"column:rating;type:decimal(3,2);default:0.00"`
	AICompatible      bool    `json:"aicompatible" gorm:"column:aicompatible;default:false"`
	AITags            JSONMap `json:"aitags" gorm:"column:aitags;type:json"`
	SuggestedUseCases JSONMap `json:"suggestedusecases" gorm:"column:suggestedusecases;type:json"`
	IsPublic          bool    `json:"ispublic" gorm:"column:ispublic;default:true"`
	IsSystem          bool    `json:"issystem" gorm:"column:issystem;default:false"`

	// Standard IAC audit fields (must be at end)
	Active          bool   `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       Time   `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      Time   `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int    `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

ReportTemplate represents a pre-built report template

func (ReportTemplate) TableName

func (ReportTemplate) TableName() string

TableName specifies the table name

type ReportType

type ReportType string

ReportType represents the type of report

const (
	ReportTypeManual      ReportType = "manual"
	ReportTypeAIGenerated ReportType = "ai_generated"
	ReportTypeTemplate    ReportType = "template"
)

type ResolvedEndpointConfig

type ResolvedEndpointConfig struct {
	Endpoint           *HubEndpoint           `json:"endpoint"`
	ProtocolGroup      *HubProtocolGroup      `json:"protocol_group"`
	Instance           *HubInstance           `json:"instance"`
	FinalTimeout       int                    `json:"final_timeout"`
	FinalRetryAttempts int                    `json:"final_retry_attempts"`
	FinalRetryInterval int                    `json:"final_retry_interval"`
	FinalMessageType   string                 `json:"final_message_type"`
	FinalAuthType      string                 `json:"final_auth_type"`
	FinalAuthConfig    map[string]interface{} `json:"final_auth_config"`
	FinalConfig        map[string]interface{} `json:"final_config"`
}

ResolvedEndpointConfig represents endpoint configuration after inheritance resolution

type RouteCondition

type RouteCondition struct {
	Field    string      `json:"field"`
	Operator string      `json:"operator"`
	Value    interface{} `json:"value"`
}

RouteCondition defines a routing condition

type RouteConditions

type RouteConditions []RouteCondition

RouteConditions stores array of routing conditions in JSONB

func (*RouteConditions) Scan

func (r *RouteConditions) Scan(value interface{}) error

Scan implements sql.Scanner interface for JSONB

func (RouteConditions) Value

func (r RouteConditions) Value() (driver.Value, error)

Value implements driver.Valuer interface for JSONB

type SchemaEmbedding

type SchemaEmbedding struct {
	ID            string     `json:"id" gorm:"column:id;primaryKey;type:varchar(36);default:(UUID())"`
	DatabaseAlias string     `json:"database_alias" gorm:"column:databasealias;type:varchar(100);not null"`
	EntityType    EntityType `json:"entity_type" gorm:"column:entitytype;type:enum('table','column','business_entity','query_template');not null"`
	EntityID      string     `json:"entity_id" gorm:"column:entityid;type:varchar(36);not null"`
	EntityText    string     `json:"entity_text" gorm:"column:entitytext;type:text;not null"`
	Embedding     JSONMap    `json:"embedding" gorm:"column:embedding;type:json;not null"`
	ModelName     string     `json:"model_name" gorm:"column:modelname;type:varchar(100);default:'text-embedding-ada-002'"`

	// Standard IAC audit fields (must be at end)
	Active          bool         `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string       `json:"reference_id" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string       `json:"created_by" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       sql.NullTime `json:"created_at" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string       `json:"modified_by" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      sql.NullTime `json:"updated_at" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int          `json:"row_version_stamp" gorm:"column:rowversionstamp;default:1"`
}

SchemaEmbedding represents vector embeddings for semantic search

func (SchemaEmbedding) TableName

func (SchemaEmbedding) TableName() string

TableName specifies the table name

type SchemaMetadataRequest

type SchemaMetadataRequest struct {
	ConfigID      int      `json:"config_id" binding:"required"`
	DatabaseAlias string   `json:"database_alias" binding:"required"`
	SchemaName    string   `json:"schema_name"`
	Tables        []string `json:"tables"` // Empty means all tables
}

SchemaMetadataRequest represents request to generate schema embeddings

type SearchRequest

type SearchRequest struct {
	ConfigID   int    `json:"config_id" binding:"required"`
	SearchType string `json:"search_type" binding:"required"` // 'schema', 'entity', 'query'
	Query      string `json:"query" binding:"required"`
	Limit      int    `json:"limit"` // Default 10
}

SearchRequest represents a vector similarity search request

type SearchResponse

type SearchResponse struct {
	Results      []SearchResult `json:"results"`
	TotalResults int            `json:"total_results"`
	SearchTime   int            `json:"search_time_ms"`
}

SearchResponse represents search results

type SearchResult

type SearchResult struct {
	ID          int                    `json:"id"`
	Score       float32                `json:"score"` // Similarity score
	Type        string                 `json:"type"`
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	Metadata    map[string]interface{} `json:"metadata"`
}

SearchResult represents a single search result

type SessionMigration

type SessionMigration struct {
	SessionID    string    `json:"session_id" bson:"session_id"`
	FromInstance string    `json:"from_instance" bson:"from_instance"`
	ToInstance   string    `json:"to_instance" bson:"to_instance"`
	Reason       string    `json:"reason" bson:"reason"` // failover, load_balance, manual
	MigratedAt   time.Time `json:"migrated_at" bson:"migrated_at"`
	Success      bool      `json:"success" bson:"success"`
}

SessionMigration tracks session failover/migration between instances

type SessionStatus

type SessionStatus string

SessionStatus represents the current status of a session

const (
	SessionStatusActive   SessionStatus = "active"
	SessionStatusExpired  SessionStatus = "expired"
	SessionStatusRevoked  SessionStatus = "revoked"
	SessionStatusMigrated SessionStatus = "migrated"
)

type SettingType

type SettingType string

SettingType represents the type of system setting

const (
	SettingTypeString  SettingType = "string"
	SettingTypeNumber  SettingType = "number"
	SettingTypeBoolean SettingType = "boolean"
	SettingTypeJSON    SettingType = "json"
)

type SkillManifest

type SkillManifest struct {
	Name        string         `json:"name"`
	DisplayName string         `json:"display_name"`
	Version     string         `json:"version"`
	Description string         `json:"description"`
	Category    string         `json:"category"`
	Runtime     string         `json:"runtime"`     // "python" | "node" | "bash" | "none"
	EntryPoint  string         `json:"entry_point"` // relative path within skill dir
	Tools       []SkillToolDef `json:"tools"`
}

SkillManifest describes the metadata and tool definitions of an installable skill. It is read from skill.json inside the skill package/folder.

type SkillToolDef

type SkillToolDef struct {
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	Parameters  map[string]interface{} `json:"parameters"` // JSON Schema object
}

SkillToolDef defines a single callable tool exposed by an installed skill.

type Step

type Step struct {
	ID                  string               `json:"id" bson:"id"`
	Order               int                  `json:"order" bson:"order"`
	Title               string               `json:"title" bson:"title"`
	Description         string               `json:"description" bson:"description"` // HTML or Markdown
	Attachments         []Attachment         `json:"attachments" bson:"attachments"`
	AttachmentOverrides []AttachmentOverride `json:"attachmentOverrides,omitempty" bson:"attachmentOverrides,omitempty"`
}

Step represents a single step in a work instruction

type StringSlice

type StringSlice []string

StringSlice is a JSONB-backed string slice for GORM

func (*StringSlice) Scan

func (s *StringSlice) Scan(value interface{}) error

func (StringSlice) Value

func (s StringSlice) Value() (driver.Value, error)

type SystemSetting

type SystemSetting struct {
	ID           string      `json:"id" gorm:"column:id;primaryKey;type:varchar(36);default:(UUID())"`
	SettingKey   string      `json:"settingkey" gorm:"column:settingkey;type:varchar(100);not null;uniqueIndex"`
	SettingValue string      `json:"settingvalue" gorm:"column:settingvalue;type:text"`
	SettingType  SettingType `json:"settingtype" gorm:"column:settingtype;type:enum('string','number','boolean','json');default:'string'"`
	Description  string      `json:"description" gorm:"column:description;type:text"`
	IsEncrypted  bool        `json:"isencrypted" gorm:"column:isencrypted;default:false"`

	// Standard IAC audit fields (must be at end)
	Active          bool         `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string       `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string       `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       sql.NullTime `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string       `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      sql.NullTime `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int          `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

SystemSetting represents system-wide settings

func (SystemSetting) TableName

func (SystemSetting) TableName() string

TableName specifies the table name

type ThreeDModel

type ThreeDModel struct {
	ID          string            `json:"_id" bson:"_id"`
	Name        string            `json:"name" bson:"name"`                                   // Root property - same for all versions
	Description string            `json:"description,omitempty" bson:"description,omitempty"` // Root property
	Tags        []string          `json:"tags,omitempty" bson:"tags,omitempty"`               // Root property
	Category    string            `json:"category,omitempty" bson:"category,omitempty"`       // Root property
	Thumbnail   string            `json:"thumbnail,omitempty" bson:"thumbnail,omitempty"`     // Root property
	Status      ThreeDModelStatus `json:"status,omitempty" bson:"status,omitempty"`           // Workflow status

	// Version Control
	CurrentVersion int                  `json:"currentVersion" bson:"currentVersion"` // Current version number
	Versions       []ThreeDModelVersion `json:"versions" bson:"versions"`             // Array of versions

	// Export References (document IDs for exported formats)
	ExportedFormats map[ThreeDModelFormat]string `json:"exportedFormats,omitempty" bson:"exportedFormats,omitempty"`

	// Metadata (calculated from current version)
	ObjectCount int      `json:"objectCount,omitempty" bson:"objectCount,omitempty"` // Number of objects in scene
	Materials   []string `json:"materials,omitempty" bson:"materials,omitempty"`     // List of material names used

	// Audit Fields
	CreatedBy       string    `json:"createdby" bson:"createdby"`
	CreatedOn       time.Time `json:"createdon" bson:"createdon"`
	ModifiedBy      string    `json:"modifiedby" bson:"modifiedby"`
	ModifiedOn      time.Time `json:"modifiedon" bson:"modifiedon"`
	RowVersionStamp int       `json:"rowversionstamp" bson:"rowversionstamp"`
}

ThreeDModel represents a 3D model with version control Root properties (Name, Description, Tags, Category, Status) are shared across all versions Only ModelData changes between versions

type ThreeDModelAsset

type ThreeDModelAsset struct {
	ID          string               `json:"_id" bson:"_id"`
	Name        string               `json:"name" bson:"name"`
	Type        ThreeDModelAssetType `json:"type" bson:"type"`
	Description string               `json:"description,omitempty" bson:"description,omitempty"`
	Tags        []string             `json:"tags,omitempty" bson:"tags,omitempty"`
	Category    string               `json:"category,omitempty" bson:"category,omitempty"`

	// Asset Data
	AssetData  map[string]interface{} `json:"assetData" bson:"assetData"` // Three.js object/material data
	Format     ThreeDModelFormat      `json:"format" bson:"format"`
	Thumbnail  string                 `json:"thumbnail,omitempty" bson:"thumbnail,omitempty"`
	PreviewURL string                 `json:"previewUrl,omitempty" bson:"previewUrl,omitempty"` // 3D preview

	// File Reference (if asset is from imported file)
	DocumentID string `json:"documentId,omitempty" bson:"documentId,omitempty"`

	// Metadata
	IsPublic      bool   `json:"isPublic" bson:"isPublic"`     // Shared with all users
	UsageCount    int    `json:"usageCount" bson:"usageCount"` // Track how many times used
	IsAIGenerated bool   `json:"isAIGenerated" bson:"isAIGenerated"`
	AIPrompt      string `json:"aiPrompt,omitempty" bson:"aiPrompt,omitempty"`

	// Technical Details
	PolyCount   int                    `json:"polyCount,omitempty" bson:"polyCount,omitempty"`     // Polygon count
	BoundingBox map[string]interface{} `json:"boundingBox,omitempty" bson:"boundingBox,omitempty"` // Size info

	// Audit Fields
	CreatedBy       string    `json:"createdby" bson:"createdby"`
	CreatedOn       time.Time `json:"createdon" bson:"createdon"`
	ModifiedBy      string    `json:"modifiedby" bson:"modifiedby"`
	ModifiedOn      time.Time `json:"modifiedon" bson:"modifiedon"`
	RowVersionStamp int       `json:"rowversionstamp" bson:"rowversionstamp"`
}

ThreeDModelAsset represents a reusable 3D asset in the library

type ThreeDModelAssetCreateRequest

type ThreeDModelAssetCreateRequest struct {
	Name          string                 `json:"name" binding:"required"`
	Type          ThreeDModelAssetType   `json:"type" binding:"required"`
	Description   string                 `json:"description,omitempty"`
	Tags          []string               `json:"tags,omitempty"`
	Category      string                 `json:"category,omitempty"`
	AssetData     map[string]interface{} `json:"assetData" binding:"required"`
	Format        ThreeDModelFormat      `json:"format"`
	Thumbnail     string                 `json:"thumbnail,omitempty"`
	IsPublic      bool                   `json:"isPublic"`
	IsAIGenerated bool                   `json:"isAIGenerated"`
	AIPrompt      string                 `json:"aiPrompt,omitempty"`
	DocumentID    string                 `json:"documentId,omitempty"`
}

ThreeDModelAssetCreateRequest represents the request to create a new asset

type ThreeDModelAssetListResponse

type ThreeDModelAssetListResponse struct {
	Data  []ThreeDModelAsset `json:"data"`
	Count int                `json:"count"`
}

ThreeDModelAssetListResponse represents the response for listing assets

type ThreeDModelAssetType

type ThreeDModelAssetType string

ThreeDModelAssetType represents the type of 3D asset

const (
	ThreeDModelAssetTypePrimitive ThreeDModelAssetType = "PRIMITIVE" // Basic shapes
	ThreeDModelAssetTypeModel     ThreeDModelAssetType = "MODEL"     // Complex models
	ThreeDModelAssetTypeMaterial  ThreeDModelAssetType = "MATERIAL"  // Material presets
	ThreeDModelAssetTypeTexture   ThreeDModelAssetType = "TEXTURE"   // Textures
	ThreeDModelAssetTypeTemplate  ThreeDModelAssetType = "TEMPLATE"  // Scene templates
)

type ThreeDModelAssetUpdateRequest

type ThreeDModelAssetUpdateRequest struct {
	Name        string                 `json:"name,omitempty"`
	Description string                 `json:"description,omitempty"`
	Tags        []string               `json:"tags,omitempty"`
	Category    string                 `json:"category,omitempty"`
	AssetData   map[string]interface{} `json:"assetData,omitempty"`
	Thumbnail   string                 `json:"thumbnail,omitempty"`
	IsPublic    bool                   `json:"isPublic,omitempty"`
}

ThreeDModelAssetUpdateRequest represents the request to update an asset

type ThreeDModelCreateRequest

type ThreeDModelCreateRequest struct {
	Name          string                 `json:"name" binding:"required"`
	Description   string                 `json:"description,omitempty"`
	Tags          []string               `json:"tags,omitempty"`
	Category      string                 `json:"category,omitempty"`
	ModelData     map[string]interface{} `json:"modelData" binding:"required"` // Three.js scene data
	Format        ThreeDModelFormat      `json:"format"`
	Status        ThreeDModelStatus      `json:"status,omitempty"` // Initial status (defaults to DRAFT)
	IsAIGenerated bool                   `json:"isAIGenerated"`
	AIPrompt      string                 `json:"aiPrompt,omitempty"`
	Thumbnail     string                 `json:"thumbnail,omitempty"`
}

ThreeDModelCreateRequest represents the request to create a new 3D model (creates version 1)

type ThreeDModelDocument

type ThreeDModelDocument struct {
	ID        string `json:"_id" bson:"_id"`             // MongoDB ObjectID
	ModelID   string `json:"modelId" bson:"modelId"`     // Parent model UUID (same for all versions)
	Version   int    `json:"version" bson:"version"`     // Version number (1, 2, 3, etc.)
	IsDefault bool   `json:"isdefault" bson:"isdefault"` // Default version flag

	// Metadata (document-level, can vary per version)
	Name        string   `json:"name" bson:"name"`                                   // Model name
	Description string   `json:"description,omitempty" bson:"description,omitempty"` // Model description
	Category    string   `json:"category,omitempty" bson:"category,omitempty"`       // Classification
	Tags        []string `json:"tags,omitempty" bson:"tags,omitempty"`               // Search tags

	// Content - simplified to just objects array as user requested
	Objects  []map[string]interface{} `json:"objects" bson:"objects"`                       // Array of 3D objects
	Metadata map[string]interface{}   `json:"metadata,omitempty" bson:"metadata,omitempty"` // Additional metadata

	// Technical Info
	Format      ThreeDModelFormat `json:"format" bson:"format"`                               // JSON, OBJ, GLB, STL, 3DS
	ObjectCount int               `json:"objectCount,omitempty" bson:"objectCount,omitempty"` // Number of 3D objects
	Materials   []string          `json:"materials,omitempty" bson:"materials,omitempty"`     // Material names
	Thumbnail   string            `json:"thumbnail,omitempty" bson:"thumbnail,omitempty"`     // Preview image

	// AI Generation Tracking
	IsAIGenerated  bool   `json:"isAIGenerated" bson:"isAIGenerated"`                       // Created by AI?
	AIPrompt       string `json:"aiPrompt,omitempty" bson:"aiPrompt,omitempty"`             // Original prompt
	GenerationType string `json:"generationType,omitempty" bson:"generationType,omitempty"` // text-to-3d, image-to-3d, manual, sketch

	// Optional Export References
	ExportedFormats map[ThreeDModelFormat]string `json:"exportedFormats,omitempty" bson:"exportedFormats,omitempty"`

	// Audit Fields
	CreatedBy       string    `json:"createdby" bson:"createdby"`
	CreatedOn       time.Time `json:"createdon" bson:"createdon"`
	ModifiedBy      string    `json:"modifiedby" bson:"modifiedby"`
	ModifiedOn      time.Time `json:"modifiedon" bson:"modifiedon"`
	RowVersionStamp int       `json:"rowversionstamp" bson:"rowversionstamp"`

	// Soft delete
	IsActive bool `json:"isActive" bson:"isActive"` // For soft delete
}

ThreeDModelDocument represents a simplified 3D model structure where each version is stored as a separate document

type ThreeDModelDocumentCreateRequest

type ThreeDModelDocumentCreateRequest struct {
	ModelID        string                   `json:"modelId,omitempty"` // Optional - if provided, creates new version of existing model
	Name           string                   `json:"name" binding:"required"`
	Description    string                   `json:"description,omitempty"`
	Category       string                   `json:"category,omitempty"`
	Tags           []string                 `json:"tags,omitempty"`
	Objects        []map[string]interface{} `json:"objects" binding:"required"` // Array of 3D objects
	Metadata       map[string]interface{}   `json:"metadata,omitempty"`
	Format         ThreeDModelFormat        `json:"format"`
	IsAIGenerated  bool                     `json:"isAIGenerated"`
	AIPrompt       string                   `json:"aiPrompt,omitempty"`
	GenerationType string                   `json:"generationType,omitempty"`
	Thumbnail      string                   `json:"thumbnail,omitempty"`
	IsDefault      bool                     `json:"isdefault"` // Set as default version
}

ThreeDModelDocumentCreateRequest represents the request to create a new 3D model document

type ThreeDModelDocumentListResponse

type ThreeDModelDocumentListResponse struct {
	Data  []ThreeDModelDocument `json:"data"`
	Count int                   `json:"count"`
}

ThreeDModelDocumentListResponse represents the response for listing 3D model documents

type ThreeDModelDocumentUpdateRequest

type ThreeDModelDocumentUpdateRequest struct {
	Name        string                   `json:"name,omitempty"`
	Description string                   `json:"description,omitempty"`
	Category    string                   `json:"category,omitempty"`
	Tags        []string                 `json:"tags,omitempty"`
	Objects     []map[string]interface{} `json:"objects,omitempty"`
	Metadata    map[string]interface{}   `json:"metadata,omitempty"`
	Thumbnail   string                   `json:"thumbnail,omitempty"`
	IsDefault   *bool                    `json:"isdefault,omitempty"` // Pointer to distinguish between false and not provided
}

ThreeDModelDocumentUpdateRequest represents the request to update a 3D model document

type ThreeDModelFormat

type ThreeDModelFormat string

ThreeDModelFormat represents the format of the 3D model

const (
	ThreeDModelFormatJSON ThreeDModelFormat = "JSON" // Default Three.js scene format
	ThreeDModelFormatOBJ  ThreeDModelFormat = "OBJ"
	ThreeDModelFormatGLB  ThreeDModelFormat = "GLB"
	ThreeDModelFormatSTL  ThreeDModelFormat = "STL"
	ThreeDModelFormat3DS  ThreeDModelFormat = "3DS"
)

type ThreeDModelListResponse

type ThreeDModelListResponse struct {
	Data  []ThreeDModel `json:"data"`
	Count int           `json:"count"`
}

ThreeDModelListResponse represents the response for listing 3D models

type ThreeDModelStatus

type ThreeDModelStatus string

ThreeDModelStatus represents the workflow status of the 3D model

const (
	ThreeDModelStatusDraft      ThreeDModelStatus = "DRAFT"       // Initial state, work in progress
	ThreeDModelStatusInProgress ThreeDModelStatus = "IN_PROGRESS" // Actively being worked on
	ThreeDModelStatusReview     ThreeDModelStatus = "REVIEW"      // Ready for review
	ThreeDModelStatusPublished  ThreeDModelStatus = "PUBLISHED"   // Approved and published
	ThreeDModelStatusArchived   ThreeDModelStatus = "ARCHIVED"    // No longer active
)

type ThreeDModelUpdateRequest

type ThreeDModelUpdateRequest struct {
	Name               string                 `json:"name,omitempty"`               // Update root property
	Description        string                 `json:"description,omitempty"`        // Update root property
	Tags               []string               `json:"tags,omitempty"`               // Update root property
	Category           string                 `json:"category,omitempty"`           // Update root property
	Status             ThreeDModelStatus      `json:"status,omitempty"`             // Update workflow status
	ModelData          map[string]interface{} `json:"modelData,omitempty"`          // If provided, creates new version
	VersionDescription string                 `json:"versionDescription,omitempty"` // For new version
	SetAsDefault       bool                   `json:"setAsDefault,omitempty"`       // Set the new version as default
	Thumbnail          string                 `json:"thumbnail,omitempty"`          // Update root property
}

ThreeDModelUpdateRequest represents the request to update a 3D model Can update root properties (name, description, tags, category, status) OR create new version with ModelData

type ThreeDModelVersion

type ThreeDModelVersion struct {
	Version            int                    `json:"version" bson:"version"`                                           // Version number (1, 2, 3, etc.)
	IsDefault          bool                   `json:"isDefault" bson:"isDefault"`                                       // True if this is the default version to load
	VersionDescription string                 `json:"versionDescription,omitempty" bson:"versionDescription,omitempty"` // What changed in this version
	ModelData          map[string]interface{} `json:"modelData" bson:"modelData"`                                       // Three.js scene data with all objects
	Format             ThreeDModelFormat      `json:"format" bson:"format"`
	IsAIGenerated      bool                   `json:"isAIGenerated" bson:"isAIGenerated"`           // Track if generated by AI
	AIPrompt           string                 `json:"aiPrompt,omitempty" bson:"aiPrompt,omitempty"` // Original AI prompt
	CreatedBy          string                 `json:"createdby" bson:"createdby"`
	CreatedOn          time.Time              `json:"createdon" bson:"createdon"`
}

ThreeDModelVersion represents a version of a 3D model

type ThreeDModelVersionListResponse

type ThreeDModelVersionListResponse struct {
	ModelID  string               `json:"modelId"`
	Name     string               `json:"name"`
	Versions []ThreeDModelVersion `json:"versions"`
}

ThreeDModelVersionListResponse represents the response for listing versions

type ThreeDView

type ThreeDView struct {
	ID                string   `json:"id" bson:"id"`
	Name              string   `json:"name" bson:"name"`
	CameraOrbit       string   `json:"cameraOrbit" bson:"cameraOrbit"`
	CameraTarget      string   `json:"cameraTarget" bson:"cameraTarget"`
	HiddenNodeNames   []string `json:"hiddenNodeNames" bson:"hiddenNodeNames"`
	AssemblyNodeNames []string `json:"assemblyNodeNames,omitempty" bson:"assemblyNodeNames,omitempty"`
	AnimationSpeed    float64  `json:"animationSpeed,omitempty" bson:"animationSpeed,omitempty"`
	AutoPlayAssembly  bool     `json:"autoPlayAssembly,omitempty" bson:"autoPlayAssembly,omitempty"`
	AssemblyDelay     float64  `json:"assemblyDelay,omitempty" bson:"assemblyDelay,omitempty"`
}

ThreeDView represents a saved camera view for 3D models

type ThreeDViewConfig

type ThreeDViewConfig struct {
	HighlightedNodeNames []string `json:"highlightedNodeNames" bson:"highlightedNodeNames"`
	AssemblyNodeNames    []string `json:"assemblyNodeNames" bson:"assemblyNodeNames"` // For exploded view animation
	HiddenNodeNames      []string `json:"hiddenNodeNames" bson:"hiddenNodeNames"`
	AnimationSpeed       float64  `json:"animationSpeed" bson:"animationSpeed"`
}

ThreeDViewConfig represents configuration for 3D model views

type Time

type Time struct {
	time.Time
}

Time is a custom time type that can handle both []uint8 and time.Time scanning

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*Time) Scan

func (t *Time) Scan(value interface{}) error

Scan implements the sql.Scanner interface

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

func (Time) Value

func (t Time) Value() (driver.Value, error)

Value implements the driver.Valuer interface

type UserStat

type UserStat struct {
	UserID     string `json:"user_id"`
	TotalCalls int64  `json:"total_calls"`
}

UserStat represents statistics for a specific user

type Vector

type Vector = pgvector.Vector

Vector represents a pgvector embedding using the official pgvector-go library This type alias allows seamless integration with PostgreSQL's pgvector extension

type VectorArray

type VectorArray []float64

VectorArray is a helper type for vector operations

func (*VectorArray) Scan

func (v *VectorArray) Scan(value interface{}) error

Scan implements the sql.Scanner interface for vector arrays

func (VectorArray) Value

func (v VectorArray) Value() (driver.Value, error)

Value implements the driver.Valuer interface for vector arrays

type WorkInstruction

type WorkInstruction struct {
	ID           string            `json:"_id" bson:"_id"`
	PartNumber   string            `json:"partNumber" bson:"partNumber"`
	Title        string            `json:"title" bson:"title"`
	Version      string            `json:"version" bson:"version"`
	Status       InstructionStatus `json:"status" bson:"status"`
	LastModified time.Time         `json:"lastModified" bson:"lastModified"`
	Author       string            `json:"author" bson:"author"`
	Attachments  []Attachment      `json:"attachments,omitempty" bson:"attachments,omitempty"` // Root-level shared attachments
	Steps        []Step            `json:"steps" bson:"steps"`

	// Additional metadata
	Tags        []string `json:"tags,omitempty" bson:"tags,omitempty"`
	Category    string   `json:"category,omitempty" bson:"category,omitempty"`
	Description string   `json:"description,omitempty" bson:"description,omitempty"`

	// Audit Fields
	CreatedBy       string    `json:"createdby" bson:"createdby"`
	CreatedOn       time.Time `json:"createdon" bson:"createdon"`
	ModifiedBy      string    `json:"modifiedby" bson:"modifiedby"`
	ModifiedOn      time.Time `json:"modifiedon" bson:"modifiedon"`
	RowVersionStamp int       `json:"rowversionstamp" bson:"rowversionstamp"`
}

WorkInstruction represents a complete work instruction document

type WorkInstructionCreateRequest

type WorkInstructionCreateRequest struct {
	PartNumber  string            `json:"partNumber" binding:"required"`
	Title       string            `json:"title" binding:"required"`
	Version     string            `json:"version" binding:"required"`
	Status      InstructionStatus `json:"status"`
	Author      string            `json:"author" binding:"required"`
	Attachments []Attachment      `json:"attachments,omitempty"`
	Steps       []Step            `json:"steps"`
	Tags        []string          `json:"tags,omitempty"`
	Category    string            `json:"category,omitempty"`
	Description string            `json:"description,omitempty"`
}

WorkInstructionCreateRequest represents the request to create a new work instruction

type WorkInstructionUpdateRequest

type WorkInstructionUpdateRequest struct {
	PartNumber  string            `json:"partNumber,omitempty"`
	Title       string            `json:"title,omitempty"`
	Version     string            `json:"version,omitempty"`
	Status      InstructionStatus `json:"status,omitempty"`
	Author      string            `json:"author,omitempty"`
	Attachments []Attachment      `json:"attachments,omitempty"`
	Steps       []Step            `json:"steps,omitempty"`
	Tags        []string          `json:"tags,omitempty"`
	Category    string            `json:"category,omitempty"`
	Description string            `json:"description,omitempty"`
}

WorkInstructionUpdateRequest represents the request to update an existing work instruction

type WorldPosition

type WorldPosition struct {
	X float64 `json:"x" bson:"x"`
	Y float64 `json:"y" bson:"y"`
	Z float64 `json:"z" bson:"z"`
}

WorldPosition represents 3D coordinates for 3D annotations

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL