// SPDX-FileCopyrightText: Copyright 2025 Stacklok, Inc.
// SPDX-License-Identifier: Apache-2.0

package session

import (
	"errors"
	"net/http"

	"github.com/stacklok/toolhive-core/httperr"
)

// Common session errors
var (
	// ErrSessionDisconnected is returned when trying to send to a disconnected session
	ErrSessionDisconnected = httperr.WithCode(
		errors.New("session is disconnected"),
		http.StatusServiceUnavailable,
	)

	// ErrMessageChannelFull is returned when the message channel is full
	ErrMessageChannelFull = httperr.WithCode(
		errors.New("message channel is full"),
		http.StatusServiceUnavailable,
	)

	// ErrSessionNotFound is returned when a session cannot be found
	ErrSessionNotFound = httperr.WithCode(
		errors.New("session not found"),
		http.StatusNotFound,
	)

	// ErrSessionAlreadyExists is returned when trying to create a session with an existing ID
	ErrSessionAlreadyExists = httperr.WithCode(
		errors.New("session already exists"),
		http.StatusConflict,
	)

	// ErrInvalidSessionType is returned when an invalid session type is provided
	ErrInvalidSessionType = httperr.WithCode(
		errors.New("invalid session type"),
		http.StatusBadRequest,
	)
)
