package model

import (
	"time"
)

// SecurityLevel 安全等级
type SecurityLevel string

const (
	SecurityLevelSafe   SecurityLevel = "safe"
	SecurityLevelReview SecurityLevel = "review"
	SecurityLevelDanger SecurityLevel = "danger"
)

// Agent 智能体
type Agent struct {
	ID          string   `json:"id" gorm:"primaryKey"`
	Name        string   `json:"name" gorm:"size:100;not null"`
	Description string   `json:"description" gorm:"type:text"`
	OwnerID     string   `json:"owner_id" gorm:"size:50;not null;index"`

	// Agent能力配置
	Capabilities []string `json:"capabilities" gorm:"type:text"` // JSON数组，可用工具列表
	MemoryLimit  int64    `json:"memory_limit" gorm:"default:134217728"` // 128MB
	Timeout      int      `json:"timeout" gorm:"default:60"` // 60秒

	// 安全配置
	SecurityLevel       SecurityLevel `json:"security_level" gorm:"size:20;default:'safe'"`
	AllowDangerousTools bool          `json:"allow_dangerous_tools" gorm:"default:false"`

	// 状态
	IsActive bool `json:"is_active" gorm:"default:true"`

	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

// AgentRequest 聊天请求
type AgentRequest struct {
	AgentID   string                 `json:"agent_id" binding:"required"`
	Message   string                 `json:"message" binding:"required"`
	SessionID string                 `json:"session_id"`
	Context   map[string]interface{} `json:"context"`
}

// AgentResponse 聊天响应
type AgentResponse struct {
	Reply     string                 `json:"reply"`
	SessionID string                 `json:"session_id"`
	ToolsUsed []string              `json:"tools_used"`
	Metadata  map[string]interface{} `json:"metadata"`
}
