// Package console 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 console

import (
	"github.com/gofrs/uuid"
)

// Defines values for ConsoleControlType.
const (
	Eof    ConsoleControlType = "eof"
	Error  ConsoleControlType = "error"
	Exit   ConsoleControlType = "exit"
	Ready  ConsoleControlType = "ready"
	Resize ConsoleControlType = "resize"
)

// Defines values for ConsoleKind.
const (
	Logs     ConsoleKind = "logs"
	Terminal ConsoleKind = "terminal"
)

// ConsoleCapabilities What a driver can do with one specific target. Resolved against live state rather than a static table, because whether a target admits a terminal generally depends on its current status.
type ConsoleCapabilities struct {
	// Containers The addressable sub-targets, if the resource has any.
	Containers []string `json:"containers,omitempty" yaml:"containers,omitempty"`

	// DefaultContainer The sub-target used when ConsoleTarget.container is empty.
	DefaultContainer string `json:"defaultContainer,omitempty" yaml:"defaultContainer,omitempty"`

	// Logs Whether a log stream can be opened.
	Logs bool `json:"logs" yaml:"logs"`

	// Reason Explains, for a human, why an unsupported console kind is unsupported — e.g. that the pod is not running.
	Reason string `json:"reason,omitempty" yaml:"reason,omitempty"`

	// Terminal Whether an interactive terminal can be opened.
	Terminal bool `json:"terminal" yaml:"terminal"`
}

// ConsoleControlMessage The JSON payload of a console WebSocket's text frames.
// A console socket carries two interleaved channels, distinguished by WebSocket opcode rather than by an envelope field. Binary frames carry raw payload bytes: stdin keystrokes from the client (terminal consoles only), and stdout or log bytes to the client. Text frames carry one of these JSON control messages.
// Splitting on opcode keeps the hot path allocation-light and avoids base64-inflating every keystroke and every log line by a third. It is also required for correctness: terminal output is not valid UTF-8 in general — it carries escape sequences, and arbitrary octets from a program writing raw bytes — so a text frame could not carry it faithfully.
// Every console ends with exactly one terminal control frame (`error`, `exit`, or `eof`) before the socket is closed, so a client never has to infer why a stream stopped from the close code alone. The close code is 4000 when the console ended as intended and 4001 when it failed; both sit in the private-use range RFC 6455 §7.4.2 reserves for applications.
// Fields not relevant to a given `type` are omitted.
type ConsoleControlMessage struct {
	// Capabilities The resolved target capabilities. Carried by `ready`, which the server sends once, after it has attached to the target. It lets a client render the sub-target it actually attached to when the request left `container` unspecified.
	// Deliberately left as a pointer in Go: `omitempty` does not elide an empty struct, so a value type would stamp an empty capabilities object onto every `error` and `exit` frame.
	Capabilities *ConsoleCapabilities `json:"capabilities,omitempty" yaml:"capabilities,omitempty"`

	// Code The MeshKit error code of an `error` frame, e.g. "meshery-server-1447". Lets a client branch on the failure without parsing prose.
	Code string `json:"code,omitempty" yaml:"code,omitempty"`

	// Cols Terminal width in character cells. Carried by `resize`.
	Cols int `json:"cols,omitempty" yaml:"cols,omitempty"`

	// ExitCode The remote command's status. Carried by `exit`.
	ExitCode int `json:"exitCode" yaml:"exitCode"`

	// Message The human-readable description of an `error` frame.
	Message string `json:"message,omitempty" yaml:"message,omitempty"`

	// Rows Terminal height in character cells. Carried by `resize`.
	Rows int `json:"rows,omitempty" yaml:"rows,omitempty"`

	// Type Identifies a console control frame. `resize` travels client-to-server; the rest travel server-to-client. A receiver ignores an unknown or wrong-direction type, so a newer peer can send frames an older one does not know about without breaking the console.
	Type ConsoleControlType `json:"type" yaml:"type"`
}

// ConsoleControlType Identifies a console control frame. `resize` travels client-to-server; the rest travel server-to-client. A receiver ignores an unknown or wrong-direction type, so a newer peer can send frames an older one does not know about without breaking the console.
type ConsoleControlType string

// ConsoleKind The kinds of console a driver may support for a given target.
type ConsoleKind string

// ConsoleTarget Addresses the resource a console attaches to, within the universe of a single connection. The field names read Kubernetes-ish because that is the first driver, but each driver interprets them for itself: `namespace` is any parent scope, `container` is any sub-target within `name`. A driver ignores the fields it has no use for.
type ConsoleTarget struct {
	// Container Selects a sub-target within the resource, if it has any.
	Container string `json:"container,omitempty" yaml:"container,omitempty"`

	// Name Identifies the resource within its scope.
	Name string `json:"name" yaml:"name"`

	// Namespace The parent scope of the resource, if it has one.
	Namespace string `json:"namespace,omitempty" yaml:"namespace,omitempty"`

	// Resource The driver-specific resource type, e.g. "pod".
	Resource string `json:"resource" yaml:"resource"`
}

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

// Container defines model for container.
type Container = string

// Name defines model for name.
type Name = string

// Namespace defines model for namespace.
type Namespace = string

// Resource defines model for resource.
type Resource = string
