package types

// McpClient represents an MCP client that is authorized to access the MCPJungle MCP Proxy server.
type McpClient struct {
	// Name is the name of the client that uniquely identifies it within mcpungle.
	Name        string `json:"name"`
	Description string `json:"description"`
	AccessToken string `json:"access_token,omitempty"`

	// IsCustomAccessToken indicates whether the access token was provided by the user (true) or generated by MCPJungle (false).
	IsCustomAccessToken bool `json:"is_custom_access_token"`

	// AllowList is a list of MCP Servers that this client is allowed to access from MCPJungle.
	AllowList []string `json:"allow_list"`
}

// AccessTokenRef describes how to load a secret access token from an external source.
type AccessTokenRef struct {
	// Env indicates that the access token should be loaded from an environment variable.
	// The value is the name of the environment variable.
	Env string `json:"env"`

	// File indicates that the access token should be loaded from a file.
	// The value is the path to the file.
	File string `json:"file"`
}

// McpClientConfig describes the JSON configuration for creating an MCP client.
type McpClientConfig struct {
	// Name is the unique name of the MCP client (mandatory)
	Name string `json:"name"`

	Description string `json:"description,omitempty"`

	// AllowMcpServers is a list of MCP servers that this client is allowed to access.
	// Use the wildcard operator "*" to allow access to all MCP servers in MCPJungle.
	AllowMcpServers []string `json:"allowed_servers"`

	// AccessToken allows you to provide a custom access token the client can use
	// to authenticate with MCPJungle.
	// It is not recommended to use this field in production environments, since
	// a hard-coded access token can be a security risk.
	// Instead, use the AccessTokenRef field to load the access token from
	// a secure location.
	AccessToken string `json:"access_token,omitempty"`

	// AccessTokenRef allows you to specify how to load the access token from
	// an external source. Use this in production scenarios, especially when
	// you want to commit the MCP client configuration to version control.
	AccessTokenRef AccessTokenRef `json:"access_token_ref"`
}

// AllowAllMcpServers is a wildcard operator used to indicate that a mcp client has access to all mcp servers
// in mcpjungle.
const AllowAllMcpServers = "*"
