// Package connection provides primitives to interact with the openapi HTTP API.
//
// Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.1 DO NOT EDIT.
package connection

import (
	"time"

	"github.com/meshery/schemas/models/core"
	environmentv1beta1 "github.com/meshery/schemas/models/v1beta1/environment"
	"github.com/gofrs/uuid"
)

// Defines values for ConnectionStatus.
const (
	ConnectionStatusConnected    ConnectionStatus = "connected"
	ConnectionStatusDeleted      ConnectionStatus = "deleted"
	ConnectionStatusDisconnected ConnectionStatus = "disconnected"
	ConnectionStatusDiscovered   ConnectionStatus = "discovered"
	ConnectionStatusIgnored      ConnectionStatus = "ignored"
	ConnectionStatusMaintenance  ConnectionStatus = "maintenance"
	ConnectionStatusNotFound     ConnectionStatus = "not found"
	ConnectionStatusRegistered   ConnectionStatus = "registered"
)

// Defines values for ConnectionStatusValue.
const (
	ConnectionStatusValueConnected    ConnectionStatusValue = "connected"
	ConnectionStatusValueDeleted      ConnectionStatusValue = "deleted"
	ConnectionStatusValueDisconnected ConnectionStatusValue = "disconnected"
	ConnectionStatusValueDiscovered   ConnectionStatusValue = "discovered"
	ConnectionStatusValueIgnored      ConnectionStatusValue = "ignored"
	ConnectionStatusValueMaintenance  ConnectionStatusValue = "maintenance"
	ConnectionStatusValueNotFound     ConnectionStatusValue = "not found"
	ConnectionStatusValueRegistered   ConnectionStatusValue = "registered"
)

// Connection Meshery Connections are managed and unmanaged resources that either through discovery or manual entry are tracked by Meshery. Learn more at https://docs.meshery.io/concepts/logical/connections
type Connection struct {
	// Id A Universally Unique Identifier used to uniquely identify entities in Meshery. The UUID core definition is used across different schemas.
	ID core.Uuid `db:"id" json:"id" yaml:"id"`

	// Name Connection Name
	Name string `db:"name" json:"name" yaml:"name"`

	// CredentialId A Universally Unique Identifier used to uniquely identify entities in Meshery. The UUID core definition is used across different schemas.
	CredentialID *core.Uuid `db:"credential_id" json:"credential_id,omitempty" yaml:"credential_id"`

	// Type Connection Type (platform, telemetry, collaboration)
	Type string `db:"type" json:"type" yaml:"type"`

	// SubType Connection Subtype (cloud, identity, metrics, chat, git, orchestration)
	SubType string `db:"sub_type" json:"sub_type" yaml:"sub_type"`

	// Kind Connection Kind (meshery, kubernetes, prometheus, grafana, gke, aws, azure, slack, github)
	Kind string `db:"kind" json:"kind" yaml:"kind"`

	// Metadata Additional connection metadata
	Metadata core.Map `db:"metadata" json:"metadata,omitempty" yaml:"metadata"`

	// Status Connection Status
	Status ConnectionStatus `db:"status" json:"status" yaml:"status"`

	// UserId A Universally Unique Identifier used to uniquely identify entities in Meshery. The UUID core definition is used across different schemas.
	UserID    *core.Uuid `db:"owner" json:"user_id,omitempty" yaml:"user_id"`
	CreatedAt core.Time  `db:"created_at" json:"created_at,omitempty" yaml:"created_at"`
	UpdatedAt core.Time  `db:"updated_at" json:"updated_at,omitempty" yaml:"updated_at"`

	// DeletedAt SQL null Timestamp to handle null values of time.
	DeletedAt core.NullTime `db:"deleted_at" json:"deleted_at" yaml:"deleted_at"`

	// Environments Associated environments for this connection
	Environments []*environmentv1beta1.Environment `db:"-" gorm:"-" json:"environments,omitempty" yaml:"environments"`

	// SchemaVersion API version of the object, optionally prefixed with an API group (e.g. "group.example.io/v1beta1" or bare "v1beta1").
	SchemaVersion core.VersionString `gorm:"-" db:"-" json:"schemaVersion" yaml:"schemaVersion"`
}

// ConnectionStatus Connection Status
type ConnectionStatus string

// ConnectionPage Represents a page of connections with meta information about connections count
type ConnectionPage struct {
	// Connections List of connections on this page
	Connections []*Connection `json:"connections" yaml:"connections"`

	// TotalCount Total number of connections on all pages
	TotalCount int `json:"total_count" yaml:"total_count"`

	// Page Current page number
	Page int `json:"page" yaml:"page"`

	// PageSize Number of elements per page
	PageSize int `json:"page_size" yaml:"page_size"`

	// StatusSummary Aggregate count of connections grouped by status
	StatusSummary *map[ConnectionStatusValue]int `json:"statusSummary,omitempty" yaml:"statusSummary,omitempty"`
}

// ConnectionPayload Payload for creating or updating a connection
type ConnectionPayload struct {
	// CredentialID Associated credential ID
	CredentialID *uuid.UUID `json:"credentialId,omitempty" yaml:"credentialId,omitempty"`

	// CredentialSecret Credential secret data
	CredentialSecret core.Map `json:"credentialSecret" yaml:"credentialSecret"`

	// ConnectionID Connection ID
	ConnectionID *uuid.UUID `json:"id,omitempty" yaml:"id,omitempty"`

	// Kind Connection kind
	Kind string `json:"kind" yaml:"kind"`

	// Metadata Connection metadata
	Metadata core.Map `json:"metadata" yaml:"metadata"`

	// Name Connection name
	Name string `json:"name" yaml:"name"`

	// Status Connection status
	Status string `json:"status" yaml:"status"`

	// SubType Connection sub-type
	SubType string `json:"subType" yaml:"subType"`

	// Type Connection type
	Type string `json:"type" yaml:"type"`
}

// ConnectionStatusInfo Status count information for connections
type ConnectionStatusInfo struct {
	// Count Number of connections with this status
	Count int `db:"count" json:"count" yaml:"count"`

	// Status Status value
	Status string `db:"status" json:"status" yaml:"status"`
}

// ConnectionStatusValue Connection Status Value
type ConnectionStatusValue string

// ConnectionsStatusPage Paginated list of connection status counts
type ConnectionsStatusPage struct {
	// ConnectionsStatus List of status counts
	ConnectionsStatus []ConnectionStatusInfo `json:"connectionsStatus" yaml:"connectionsStatus"`

	// Page Current page number
	Page int `json:"page" yaml:"page"`

	// PageSize Number of items per page
	PageSize int `json:"page_size" yaml:"page_size"`

	// TotalCount Total number of status entries
	TotalCount int `json:"total_count" yaml:"total_count"`
}

// MesheryCompatibility Meshery version compatibility check
type MesheryCompatibility struct {
	// CheckCompatibility Whether to check compatibility
	CheckCompatibility *bool `json:"checkCompatibility,omitempty" yaml:"checkCompatibility,omitempty"`

	// MesheryVersion Meshery version string
	MesheryVersion *string `json:"mesheryVersion,omitempty" yaml:"mesheryVersion,omitempty"`
}

// MesheryInstance Meshery server instance information
type MesheryInstance struct {
	// CreatedAt Creation timestamp
	CreatedAt *time.Time `db:"created_at" json:"created_at,omitempty" yaml:"created_at,omitempty"`

	// DeletedAt Deletion timestamp
	DeletedAt *time.Time `db:"deleted_at" json:"deleted_at,omitempty" yaml:"deleted_at,omitempty"`

	// Id Instance ID
	ID *uuid.UUID `db:"id" json:"id,omitempty" yaml:"id,omitempty"`

	// Name Instance name
	Name *string `db:"name" json:"name,omitempty" yaml:"name,omitempty"`

	// ServerBuildSHA Server build SHA
	ServerBuildSHA *string `db:"server_build_sha" json:"server_build_sha,omitempty" yaml:"server_build_sha,omitempty"`

	// ServerID Server ID
	ServerID *uuid.UUID `db:"server_id" json:"server_id,omitempty" yaml:"server_id,omitempty"`

	// ServerLocation Server location URL
	ServerLocation *string `db:"server_location" json:"server_location,omitempty" yaml:"server_location,omitempty"`

	// ServerVersion Meshery server version
	ServerVersion *string `db:"server_version" json:"server_version,omitempty" yaml:"server_version,omitempty"`

	// UpdatedAt Last update timestamp
	UpdatedAt *time.Time `db:"updated_at" json:"updated_at,omitempty" yaml:"updated_at,omitempty"`
}

// MesheryInstancePage Paginated list of Meshery instances
type MesheryInstancePage struct {
	// MesheryInstances List of Meshery instances
	MesheryInstances []MesheryInstance `json:"mesheryInstances" yaml:"mesheryInstances"`

	// Page Current page number
	Page int `json:"page" yaml:"page"`

	// PageSize Number of items per page
	PageSize int `json:"page_size" yaml:"page_size"`

	// TotalCount Total number of instances
	TotalCount int `json:"total_count" yaml:"total_count"`
}

// ConnectionId defines model for connectionId.
type ConnectionId = uuid.UUID

// ConnectionKind defines model for connectionKind.
type ConnectionKind = string

// EnvironmentId defines model for environmentId.
type EnvironmentId = uuid.UUID

// Order defines model for order.
type Order = string

// Page defines model for page.
type Page = int

// Pagesize defines model for pagesize.
type Pagesize = int

// Search defines model for search.
type Search = string
