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

import (
	"bytes"
	"compress/flate"
	"context"
	"encoding/base64"
	"errors"
	"fmt"
	"net/http"
	"net/url"
	"path"
	"strings"

	"github.com/getkin/kin-openapi/openapi3"
	"github.com/go-chi/chi/v5"
	"github.com/oapi-codegen/runtime"
	openapi_types "github.com/oapi-codegen/runtime/types"
)

// ServerInterface represents all server handlers.
type ServerInterface interface {
	// 激励视频广告解锁当日时长
	// (POST /ads/unlock)
	AdsUnlock(w http.ResponseWriter, r *http.Request)
	// 发送邮箱验证码
	// (POST /auth/code)
	SendVerificationCode(w http.ResponseWriter, r *http.Request)
	// 登录
	// (POST /auth/login)
	Login(w http.ResponseWriter, r *http.Request)
	// 刷新 Access Token
	// (POST /auth/refresh)
	RefreshToken(w http.ResponseWriter, r *http.Request)
	// 注册账户
	// (POST /auth/register)
	Register(w http.ResponseWriter, r *http.Request)
	// 获取当前账户信息
	// (GET /me)
	GetMe(w http.ResponseWriter, r *http.Request)
	// 获取设备列表
	// (GET /me/devices)
	ListDevices(w http.ResponseWriter, r *http.Request)
	// 移除设备
	// (DELETE /me/devices/{id})
	DeleteDevice(w http.ResponseWriter, r *http.Request, id openapi_types.UUID)
	// 获取节点目录
	// (GET /nodes)
	ListNodes(w http.ResponseWriter, r *http.Request, params ListNodesParams)
	// 连接节点 — 下发连接凭证
	// (POST /nodes/{id}/connect)
	ConnectNode(w http.ResponseWriter, r *http.Request, id openapi_types.UUID)
	// 断开节点连接
	// (POST /nodes/{id}/disconnect)
	DisconnectNode(w http.ResponseWriter, r *http.Request, id openapi_types.UUID)
	// 获取公告列表
	// (GET /notices)
	ListNotices(w http.ResponseWriter, r *http.Request)
	// 获取套餐目录
	// (GET /plans)
	ListPlans(w http.ResponseWriter, r *http.Request)
	// 兑换激活码
	// (POST /redeem)
	RedeemCode(w http.ResponseWriter, r *http.Request)
	// 获取用量曲线
	// (GET /usage)
	GetUsage(w http.ResponseWriter, r *http.Request, params GetUsageParams)
}

// Unimplemented server implementation that returns http.StatusNotImplemented for each endpoint.

type Unimplemented struct{}

// 激励视频广告解锁当日时长
// (POST /ads/unlock)
func (_ Unimplemented) AdsUnlock(w http.ResponseWriter, r *http.Request) {
	w.WriteHeader(http.StatusNotImplemented)
}

// 发送邮箱验证码
// (POST /auth/code)
func (_ Unimplemented) SendVerificationCode(w http.ResponseWriter, r *http.Request) {
	w.WriteHeader(http.StatusNotImplemented)
}

// 登录
// (POST /auth/login)
func (_ Unimplemented) Login(w http.ResponseWriter, r *http.Request) {
	w.WriteHeader(http.StatusNotImplemented)
}

// 刷新 Access Token
// (POST /auth/refresh)
func (_ Unimplemented) RefreshToken(w http.ResponseWriter, r *http.Request) {
	w.WriteHeader(http.StatusNotImplemented)
}

// 注册账户
// (POST /auth/register)
func (_ Unimplemented) Register(w http.ResponseWriter, r *http.Request) {
	w.WriteHeader(http.StatusNotImplemented)
}

// 获取当前账户信息
// (GET /me)
func (_ Unimplemented) GetMe(w http.ResponseWriter, r *http.Request) {
	w.WriteHeader(http.StatusNotImplemented)
}

// 获取设备列表
// (GET /me/devices)
func (_ Unimplemented) ListDevices(w http.ResponseWriter, r *http.Request) {
	w.WriteHeader(http.StatusNotImplemented)
}

// 移除设备
// (DELETE /me/devices/{id})
func (_ Unimplemented) DeleteDevice(w http.ResponseWriter, r *http.Request, id openapi_types.UUID) {
	w.WriteHeader(http.StatusNotImplemented)
}

// 获取节点目录
// (GET /nodes)
func (_ Unimplemented) ListNodes(w http.ResponseWriter, r *http.Request, params ListNodesParams) {
	w.WriteHeader(http.StatusNotImplemented)
}

// 连接节点 — 下发连接凭证
// (POST /nodes/{id}/connect)
func (_ Unimplemented) ConnectNode(w http.ResponseWriter, r *http.Request, id openapi_types.UUID) {
	w.WriteHeader(http.StatusNotImplemented)
}

// 断开节点连接
// (POST /nodes/{id}/disconnect)
func (_ Unimplemented) DisconnectNode(w http.ResponseWriter, r *http.Request, id openapi_types.UUID) {
	w.WriteHeader(http.StatusNotImplemented)
}

// 获取公告列表
// (GET /notices)
func (_ Unimplemented) ListNotices(w http.ResponseWriter, r *http.Request) {
	w.WriteHeader(http.StatusNotImplemented)
}

// 获取套餐目录
// (GET /plans)
func (_ Unimplemented) ListPlans(w http.ResponseWriter, r *http.Request) {
	w.WriteHeader(http.StatusNotImplemented)
}

// 兑换激活码
// (POST /redeem)
func (_ Unimplemented) RedeemCode(w http.ResponseWriter, r *http.Request) {
	w.WriteHeader(http.StatusNotImplemented)
}

// 获取用量曲线
// (GET /usage)
func (_ Unimplemented) GetUsage(w http.ResponseWriter, r *http.Request, params GetUsageParams) {
	w.WriteHeader(http.StatusNotImplemented)
}

// ServerInterfaceWrapper converts contexts to parameters.
type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

type MiddlewareFunc func(http.Handler) http.Handler

// AdsUnlock operation middleware
func (siw *ServerInterfaceWrapper) AdsUnlock(w http.ResponseWriter, r *http.Request) {

	ctx := r.Context()

	ctx = context.WithValue(ctx, BearerAuthScopes, []string{})

	r = r.WithContext(ctx)

	handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		siw.Handler.AdsUnlock(w, r)
	}))

	for _, middleware := range siw.HandlerMiddlewares {
		handler = middleware(handler)
	}

	handler.ServeHTTP(w, r)
}

// SendVerificationCode operation middleware
func (siw *ServerInterfaceWrapper) SendVerificationCode(w http.ResponseWriter, r *http.Request) {

	handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		siw.Handler.SendVerificationCode(w, r)
	}))

	for _, middleware := range siw.HandlerMiddlewares {
		handler = middleware(handler)
	}

	handler.ServeHTTP(w, r)
}

// Login operation middleware
func (siw *ServerInterfaceWrapper) Login(w http.ResponseWriter, r *http.Request) {

	handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		siw.Handler.Login(w, r)
	}))

	for _, middleware := range siw.HandlerMiddlewares {
		handler = middleware(handler)
	}

	handler.ServeHTTP(w, r)
}

// RefreshToken operation middleware
func (siw *ServerInterfaceWrapper) RefreshToken(w http.ResponseWriter, r *http.Request) {

	handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		siw.Handler.RefreshToken(w, r)
	}))

	for _, middleware := range siw.HandlerMiddlewares {
		handler = middleware(handler)
	}

	handler.ServeHTTP(w, r)
}

// Register operation middleware
func (siw *ServerInterfaceWrapper) Register(w http.ResponseWriter, r *http.Request) {

	handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		siw.Handler.Register(w, r)
	}))

	for _, middleware := range siw.HandlerMiddlewares {
		handler = middleware(handler)
	}

	handler.ServeHTTP(w, r)
}

// GetMe operation middleware
func (siw *ServerInterfaceWrapper) GetMe(w http.ResponseWriter, r *http.Request) {

	ctx := r.Context()

	ctx = context.WithValue(ctx, BearerAuthScopes, []string{})

	r = r.WithContext(ctx)

	handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		siw.Handler.GetMe(w, r)
	}))

	for _, middleware := range siw.HandlerMiddlewares {
		handler = middleware(handler)
	}

	handler.ServeHTTP(w, r)
}

// ListDevices operation middleware
func (siw *ServerInterfaceWrapper) ListDevices(w http.ResponseWriter, r *http.Request) {

	ctx := r.Context()

	ctx = context.WithValue(ctx, BearerAuthScopes, []string{})

	r = r.WithContext(ctx)

	handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		siw.Handler.ListDevices(w, r)
	}))

	for _, middleware := range siw.HandlerMiddlewares {
		handler = middleware(handler)
	}

	handler.ServeHTTP(w, r)
}

// DeleteDevice operation middleware
func (siw *ServerInterfaceWrapper) DeleteDevice(w http.ResponseWriter, r *http.Request) {

	var err error
	_ = err

	// ------------- Path parameter "id" -------------
	var id openapi_types.UUID

	err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "uuid"})
	if err != nil {
		siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err})
		return
	}

	ctx := r.Context()

	ctx = context.WithValue(ctx, BearerAuthScopes, []string{})

	r = r.WithContext(ctx)

	handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		siw.Handler.DeleteDevice(w, r, id)
	}))

	for _, middleware := range siw.HandlerMiddlewares {
		handler = middleware(handler)
	}

	handler.ServeHTTP(w, r)
}

// ListNodes operation middleware
func (siw *ServerInterfaceWrapper) ListNodes(w http.ResponseWriter, r *http.Request) {

	var err error
	_ = err

	ctx := r.Context()

	ctx = context.WithValue(ctx, BearerAuthScopes, []string{})

	r = r.WithContext(ctx)

	// Parameter object where we will unmarshal all parameters from the context
	var params ListNodesParams

	// ------------- Optional query parameter "if_version" -------------

	err = runtime.BindQueryParameterWithOptions("form", true, false, "if_version", r.URL.Query(), &params.IfVersion, runtime.BindQueryParameterOptions{Type: "integer", Format: "int64"})
	if err != nil {
		var requiredError *runtime.RequiredParameterError
		if errors.As(err, &requiredError) {
			siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "if_version"})
		} else {
			siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "if_version", Err: err})
		}
		return
	}

	handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		siw.Handler.ListNodes(w, r, params)
	}))

	for _, middleware := range siw.HandlerMiddlewares {
		handler = middleware(handler)
	}

	handler.ServeHTTP(w, r)
}

// ConnectNode operation middleware
func (siw *ServerInterfaceWrapper) ConnectNode(w http.ResponseWriter, r *http.Request) {

	var err error
	_ = err

	// ------------- Path parameter "id" -------------
	var id openapi_types.UUID

	err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "uuid"})
	if err != nil {
		siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err})
		return
	}

	ctx := r.Context()

	ctx = context.WithValue(ctx, BearerAuthScopes, []string{})

	r = r.WithContext(ctx)

	handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		siw.Handler.ConnectNode(w, r, id)
	}))

	for _, middleware := range siw.HandlerMiddlewares {
		handler = middleware(handler)
	}

	handler.ServeHTTP(w, r)
}

// DisconnectNode operation middleware
func (siw *ServerInterfaceWrapper) DisconnectNode(w http.ResponseWriter, r *http.Request) {

	var err error
	_ = err

	// ------------- Path parameter "id" -------------
	var id openapi_types.UUID

	err = runtime.BindStyledParameterWithOptions("simple", "id", chi.URLParam(r, "id"), &id, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true, Type: "string", Format: "uuid"})
	if err != nil {
		siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "id", Err: err})
		return
	}

	ctx := r.Context()

	ctx = context.WithValue(ctx, BearerAuthScopes, []string{})

	r = r.WithContext(ctx)

	handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		siw.Handler.DisconnectNode(w, r, id)
	}))

	for _, middleware := range siw.HandlerMiddlewares {
		handler = middleware(handler)
	}

	handler.ServeHTTP(w, r)
}

// ListNotices operation middleware
func (siw *ServerInterfaceWrapper) ListNotices(w http.ResponseWriter, r *http.Request) {

	ctx := r.Context()

	ctx = context.WithValue(ctx, BearerAuthScopes, []string{})

	r = r.WithContext(ctx)

	handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		siw.Handler.ListNotices(w, r)
	}))

	for _, middleware := range siw.HandlerMiddlewares {
		handler = middleware(handler)
	}

	handler.ServeHTTP(w, r)
}

// ListPlans operation middleware
func (siw *ServerInterfaceWrapper) ListPlans(w http.ResponseWriter, r *http.Request) {

	ctx := r.Context()

	ctx = context.WithValue(ctx, BearerAuthScopes, []string{})

	r = r.WithContext(ctx)

	handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		siw.Handler.ListPlans(w, r)
	}))

	for _, middleware := range siw.HandlerMiddlewares {
		handler = middleware(handler)
	}

	handler.ServeHTTP(w, r)
}

// RedeemCode operation middleware
func (siw *ServerInterfaceWrapper) RedeemCode(w http.ResponseWriter, r *http.Request) {

	ctx := r.Context()

	ctx = context.WithValue(ctx, BearerAuthScopes, []string{})

	r = r.WithContext(ctx)

	handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		siw.Handler.RedeemCode(w, r)
	}))

	for _, middleware := range siw.HandlerMiddlewares {
		handler = middleware(handler)
	}

	handler.ServeHTTP(w, r)
}

// GetUsage operation middleware
func (siw *ServerInterfaceWrapper) GetUsage(w http.ResponseWriter, r *http.Request) {

	var err error
	_ = err

	ctx := r.Context()

	ctx = context.WithValue(ctx, BearerAuthScopes, []string{})

	r = r.WithContext(ctx)

	// Parameter object where we will unmarshal all parameters from the context
	var params GetUsageParams

	// ------------- Optional query parameter "days" -------------

	err = runtime.BindQueryParameterWithOptions("form", true, false, "days", r.URL.Query(), &params.Days, runtime.BindQueryParameterOptions{Type: "integer", Format: ""})
	if err != nil {
		var requiredError *runtime.RequiredParameterError
		if errors.As(err, &requiredError) {
			siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "days"})
		} else {
			siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "days", Err: err})
		}
		return
	}

	handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		siw.Handler.GetUsage(w, r, params)
	}))

	for _, middleware := range siw.HandlerMiddlewares {
		handler = middleware(handler)
	}

	handler.ServeHTTP(w, r)
}

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (e *UnescapedCookieParamError) Error() string {
	return fmt.Sprintf("error unescaping cookie parameter '%s'", e.ParamName)
}

func (e *UnescapedCookieParamError) Unwrap() error {
	return e.Err
}

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (e *UnmarshalingParamError) Error() string {
	return fmt.Sprintf("Error unmarshaling parameter %s as JSON: %s", e.ParamName, e.Err.Error())
}

func (e *UnmarshalingParamError) Unwrap() error {
	return e.Err
}

type RequiredParamError struct {
	ParamName string
}

func (e *RequiredParamError) Error() string {
	return fmt.Sprintf("Query argument %s is required, but not found", e.ParamName)
}

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (e *RequiredHeaderError) Error() string {
	return fmt.Sprintf("Header parameter %s is required, but not found", e.ParamName)
}

func (e *RequiredHeaderError) Unwrap() error {
	return e.Err
}

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (e *InvalidParamFormatError) Error() string {
	return fmt.Sprintf("Invalid format for parameter %s: %s", e.ParamName, e.Err.Error())
}

func (e *InvalidParamFormatError) Unwrap() error {
	return e.Err
}

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (e *TooManyValuesForParamError) Error() string {
	return fmt.Sprintf("Expected one value for %s, got %d", e.ParamName, e.Count)
}

// Handler creates http.Handler with routing matching OpenAPI spec.
func Handler(si ServerInterface) http.Handler {
	return HandlerWithOptions(si, ChiServerOptions{})
}

type ChiServerOptions struct {
	BaseURL          string
	BaseRouter       chi.Router
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

// HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.
func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler {
	return HandlerWithOptions(si, ChiServerOptions{
		BaseRouter: r,
	})
}

func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler {
	return HandlerWithOptions(si, ChiServerOptions{
		BaseURL:    baseURL,
		BaseRouter: r,
	})
}

// HandlerWithOptions creates http.Handler with additional options
func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler {
	r := options.BaseRouter

	if r == nil {
		r = chi.NewRouter()
	}
	if options.ErrorHandlerFunc == nil {
		options.ErrorHandlerFunc = func(w http.ResponseWriter, r *http.Request, err error) {
			http.Error(w, err.Error(), http.StatusBadRequest)
		}
	}
	wrapper := ServerInterfaceWrapper{
		Handler:            si,
		HandlerMiddlewares: options.Middlewares,
		ErrorHandlerFunc:   options.ErrorHandlerFunc,
	}

	r.Group(func(r chi.Router) {
		r.Post(options.BaseURL+"/ads/unlock", wrapper.AdsUnlock)
	})
	r.Group(func(r chi.Router) {
		r.Post(options.BaseURL+"/auth/code", wrapper.SendVerificationCode)
	})
	r.Group(func(r chi.Router) {
		r.Post(options.BaseURL+"/auth/login", wrapper.Login)
	})
	r.Group(func(r chi.Router) {
		r.Post(options.BaseURL+"/auth/refresh", wrapper.RefreshToken)
	})
	r.Group(func(r chi.Router) {
		r.Post(options.BaseURL+"/auth/register", wrapper.Register)
	})
	r.Group(func(r chi.Router) {
		r.Get(options.BaseURL+"/me", wrapper.GetMe)
	})
	r.Group(func(r chi.Router) {
		r.Get(options.BaseURL+"/me/devices", wrapper.ListDevices)
	})
	r.Group(func(r chi.Router) {
		r.Delete(options.BaseURL+"/me/devices/{id}", wrapper.DeleteDevice)
	})
	r.Group(func(r chi.Router) {
		r.Get(options.BaseURL+"/nodes", wrapper.ListNodes)
	})
	r.Group(func(r chi.Router) {
		r.Post(options.BaseURL+"/nodes/{id}/connect", wrapper.ConnectNode)
	})
	r.Group(func(r chi.Router) {
		r.Post(options.BaseURL+"/nodes/{id}/disconnect", wrapper.DisconnectNode)
	})
	r.Group(func(r chi.Router) {
		r.Get(options.BaseURL+"/notices", wrapper.ListNotices)
	})
	r.Group(func(r chi.Router) {
		r.Get(options.BaseURL+"/plans", wrapper.ListPlans)
	})
	r.Group(func(r chi.Router) {
		r.Post(options.BaseURL+"/redeem", wrapper.RedeemCode)
	})
	r.Group(func(r chi.Router) {
		r.Get(options.BaseURL+"/usage", wrapper.GetUsage)
	})

	return r
}

// Base64 encoded, compressed with deflate, json marshaled OpenAPI spec.
// Stored as a slice of fixed-width chunks rather than one concatenated
// const string: with thousands of chunks the chained `+` fold is several
// times slower for the Go compiler than parsing a slice literal.
var swaggerSpec = []string{
	"5HxrUxNZGvBfOZV9q3bXQRIEnBmqrFpHZ3acUYcS3a2p0YI2aSE7oTvb3VHZKbcCckkwIWEMtxDkIpeM",
	"QoKoEJMGPrz/ZOxzuvtT/sJb55xOp5N0CKOMzlv7hSJJ9znPee7X85PDzff7eY7lJNHR8ZNDYEU/z4ks",
	"+fAF47nG/jvAihL+5OY5ieXIv4zf7/O6GcnLc85/iTyHvxPdfWw/g//7PwJ7x9Hh+JOzvLST/io6vxQE",
	"XnA8ePCgyeFhRbfg9eNFHB0OLbuHXgzB2BCa2tYXnqCXUyg0reSScHwZLS3rzyJw9YX2as3xoMlxgefu",
	"+LzuDwHU62GUj8PRHfXZYFEOwfUhfSijZl7AvR30Mg1HI2+Dg+gwiF4V1KVBuLejrTyHI5MoulKUwxjS",
	"r3jhttfjYbnfH1SlsKqGIygVRlMhZX8ULTzU5+JKLqrtvqSQw5Go9uqNGg5pmUN9JqMUZrVXb7TxIXXo",
	"zdvgoJY5gKtjSi4KXzxR8hNw/zEMR9VEGoX2jLNc4iRW4Bjf738UlIrC8WX1eRaOjugP03piTstmMQhX",
	"eekrPsB5fn8Q1PkMWhqj5MdI2ZqFqTQG4TrPX2G4AUMsxA8lF/rKpDoxpu2OaIdj+lwchnaLckRNR2F8",
	"Qh+LatkpR5Ojj2U8rEBAusZKwsDp83ckVsAfK1eEmRUU2sPozSfUrTA8GFGTw+rGz2hqG8Yn4GjUXLEM",
	"Onuf6ff7WEfHWVeTQxrws44Oh5eT2F6WAP2gyXGDYwJSHy94/8N6PgSLPEOxuHIwTxleTQ6XuBpLQVGO",
	"YOVB/sdSeTiGUosOvIqxMN73As9xrFu6ILAelpO8lLErdxG9XO/p2/x9oB0+QRNr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qeT+GBY0tw9Rds0wqzWmYVfEqm",
	"3IJwdQN87qqTejUGd8sc62HvMGSm+1PL7TifuxpcunXrZC0X7zXuWD+W6bKM1jU0YHTl41iwqnE8qyn7",
	"MHL4/tbPOML8jpq3NlRTxrr1oKoboHKQ6YdbmKj00k87xlMTi0p+Q53IwpWHjiZHQPAZA0hih9PJ+L0V",
	"97w677Y48HIGBLW1tlUtO6jO5+AIuYE9Nmk20LwNDprXx9Nuv7fBQaPr6TrteDOKNvTWU0DnrQzuJkd5",
	"0GQ/tWZmlenstOUto9RV+yKcGlVySX1mS53IYney8poDDJmlnR1/tLgftBHP2MLUOTbAWRLqGERLyoQm",
	"UazlVziyRi7QsyxNo7jadSkzUH1Ufprygs1JiVNvXZV68w9uPfh/AQAA//8=",
}

// decodeSpec returns the embedded OpenAPI spec as raw JSON bytes,
// after base64-decoding and flate-decompressing the embedded blob.
func decodeSpec() ([]byte, error) {
	encoded := strings.Join(swaggerSpec, "")
	compressed, err := base64.StdEncoding.DecodeString(encoded)
	if err != nil {
		return nil, fmt.Errorf("error base64 decoding spec: %w", err)
	}
	zr := flate.NewReader(bytes.NewReader(compressed))
	var buf bytes.Buffer
	if _, err := buf.ReadFrom(zr); err != nil {
		return nil, fmt.Errorf("read flate: %w", err)
	}
	if err := zr.Close(); err != nil {
		return nil, fmt.Errorf("close flate reader: %w", err)
	}

	return buf.Bytes(), nil
}

var rawSpec = decodeSpecCached()

// a naive cache of the decoded OpenAPI spec
func decodeSpecCached() func() ([]byte, error) {
	data, err := decodeSpec()
	return func() ([]byte, error) {
		return data, err
	}
}

// Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) {
	res := make(map[string]func() ([]byte, error))
	if len(pathToFile) > 0 {
		res[pathToFile] = rawSpec
	}

	return res
}

// GetSpec returns the OpenAPI specification corresponding to the generated
// code in this file. External references in the spec are resolved through
// PathToRawSpec; externally-referenced files must be embedded in their
// corresponding Go packages (via the import-mapping feature). URL-based
// external refs are not supported.
func GetSpec() (swagger *openapi3.T, err error) {
	resolvePath := PathToRawSpec("")

	loader := openapi3.NewLoader()
	loader.IsExternalRefsAllowed = true
	loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) {
		pathToFile := url.String()
		pathToFile = path.Clean(pathToFile)
		getSpec, ok := resolvePath[pathToFile]
		if !ok {
			err1 := fmt.Errorf("path not found: %s", pathToFile)
			return nil, err1
		}
		return getSpec()
	}
	var specData []byte
	specData, err = rawSpec()
	if err != nil {
		return
	}
	swagger, err = loader.LoadFromData(specData)
	if err != nil {
		return
	}
	return
}

// GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI
// specification: decompressed but not unmarshaled. External references
// are not resolved here; the bytes are the spec exactly as embedded by
// codegen. The result is cached at package init time, so repeated calls
// are cheap.
func GetSpecJSON() ([]byte, error) {
	return rawSpec()
}

// GetSwagger returns the OpenAPI specification corresponding to the
// generated code in this file.
//
// Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger
// to openapi3.T. Use [GetSpec] instead. This wrapper is retained for
// backwards compatibility.
func GetSwagger() (*openapi3.T, error) {
	return GetSpec()
}
