package models

// ── Extension Connections (v0.38.1) ──────────────────

// ExtConnection represents a scoped credential/endpoint configuration
// for extensions that integrate with external services. Same scope
// hierarchy as ProviderConfig: global → team → personal.
type ExtConnection struct {
	BaseModel
	Type      string `json:"type" db:"type"`
	PackageID string `json:"package_id" db:"package_id"`
	Scope     string `json:"scope" db:"scope"`
	OwnerID   string `json:"owner_id" db:"owner_id"`
	Name      string `json:"name" db:"name"`
	Config    JSONMap `json:"config" db:"config"`
	IsActive  bool   `json:"is_active" db:"is_active"`
}

// ExtConnectionPatch carries partial updates. Nil fields are skipped.
type ExtConnectionPatch struct {
	Name     *string `json:"name,omitempty"`
	Config   JSONMap  `json:"config,omitempty"`
	IsActive *bool   `json:"is_active,omitempty"`
}
