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

import (
	"bytes"
	"compress/gzip"
	"encoding/base64"
	"fmt"
	"net/http"
	"net/url"
	"path"
	"strings"

	"github.com/getkin/kin-openapi/openapi3"
	"github.com/labstack/echo/v4"
	"github.com/oapi-codegen/runtime"
)

// ServerInterface represents all server handlers.
type ServerInterface interface {
	// удалить собственный аккаунт
	// (DELETE /account)
	DeleteAccount(ctx echo.Context) error
	// Получение текущего аккаунта юзера
	// (GET /account)
	GetAccount(ctx echo.Context) error
	// Отредактировать аккаунт
	// (PATCH /account)
	ChangeAccount(ctx echo.Context) error
	// Создать новый аккаунт
	// (POST /account)
	AddAccount(ctx echo.Context) error
	// Удалить аккаунт по айди
	// (DELETE /account/{userId})
	DeleteDirectAccount(ctx echo.Context, userId string) error
	// Получить аккаунт по ID пользователя системы единой авторизации
	// (GET /account/{userId})
	GetDirectAccount(ctx echo.Context, userId string) error
	// Выставление статуса верификации
	// (PATCH /account/{userId})
	SetAccountVerificationStatus(ctx echo.Context, userId string) error
	// списко аккаунтов с пагинацией
	// (GET /accounts)
	PaginationAccounts(ctx echo.Context, params PaginationAccountsParams) error
	// Удаляем из корзины тариф
	// (DELETE /cart)
	RemoveFromCart(ctx echo.Context, params RemoveFromCartParams) error
	// Добавляем в корзину тариф
	// (PATCH /cart)
	Add2cart(ctx echo.Context, params Add2cartParams) error
	// оплатить козину
	// (POST /cart/pay)
	PayCart(ctx echo.Context) error
	// получить список одобренных валют
	// (GET /currencies)
	GetCurrencies(ctx echo.Context) error
	// обновляет список одобренных валют
	// (PUT /currencies)
	UpdateCurrencies(ctx echo.Context) error
	// Получение лога событий связанных с аккаунтом
	// (GET /history)
	GetHistory(ctx echo.Context, params GetHistoryParams) error
	// Расчет среднего времени жизни платящего клиента (LTV)
	// (POST /history/ltv)
	CalculateLTV(ctx echo.Context) error
	// Получение недавних тарифов
	// (GET /recent)
	GetRecentTariffs(ctx echo.Context) error
	// отправить акт проделанных работ на почту
	// (POST /sendReport)
	SendReport(ctx echo.Context) error
	// Изменить валюту кошелька
	// (PATCH /wallet)
	ChangeCurrency(ctx echo.Context) error
	// Запрос на получение ссылки на оплату
	// (POST /wallet)
	RequestMoney(ctx echo.Context) error
}

// ServerInterfaceWrapper converts echo contexts to parameters.
type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

// DeleteAccount converts echo context to params.
func (w *ServerInterfaceWrapper) DeleteAccount(ctx echo.Context) error {
	var err error

	ctx.Set(BearerScopes, []string{})

	// Invoke the callback with all the unmarshaled arguments
	err = w.Handler.DeleteAccount(ctx)
	return err
}

// GetAccount converts echo context to params.
func (w *ServerInterfaceWrapper) GetAccount(ctx echo.Context) error {
	var err error

	ctx.Set(BearerScopes, []string{})

	// Invoke the callback with all the unmarshaled arguments
	err = w.Handler.GetAccount(ctx)
	return err
}

// ChangeAccount converts echo context to params.
func (w *ServerInterfaceWrapper) ChangeAccount(ctx echo.Context) error {
	var err error

	ctx.Set(BearerScopes, []string{})

	// Invoke the callback with all the unmarshaled arguments
	err = w.Handler.ChangeAccount(ctx)
	return err
}

// AddAccount converts echo context to params.
func (w *ServerInterfaceWrapper) AddAccount(ctx echo.Context) error {
	var err error

	ctx.Set(BearerScopes, []string{})

	// Invoke the callback with all the unmarshaled arguments
	err = w.Handler.AddAccount(ctx)
	return err
}

// DeleteDirectAccount converts echo context to params.
func (w *ServerInterfaceWrapper) DeleteDirectAccount(ctx echo.Context) error {
	var err error
	// ------------- Path parameter "userId" -------------
	var userId string

	err = runtime.BindStyledParameterWithLocation("simple", false, "userId", runtime.ParamLocationPath, ctx.Param("userId"), &userId)
	if err != nil {
		return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter userId: %s", err))
	}

	ctx.Set(BearerScopes, []string{})

	// Invoke the callback with all the unmarshaled arguments
	err = w.Handler.DeleteDirectAccount(ctx, userId)
	return err
}

// GetDirectAccount converts echo context to params.
func (w *ServerInterfaceWrapper) GetDirectAccount(ctx echo.Context) error {
	var err error
	// ------------- Path parameter "userId" -------------
	var userId string

	err = runtime.BindStyledParameterWithLocation("simple", false, "userId", runtime.ParamLocationPath, ctx.Param("userId"), &userId)
	if err != nil {
		return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter userId: %s", err))
	}

	ctx.Set(BearerScopes, []string{})

	// Invoke the callback with all the unmarshaled arguments
	err = w.Handler.GetDirectAccount(ctx, userId)
	return err
}

// SetAccountVerificationStatus converts echo context to params.
func (w *ServerInterfaceWrapper) SetAccountVerificationStatus(ctx echo.Context) error {
	var err error
	// ------------- Path parameter "userId" -------------
	var userId string

	err = runtime.BindStyledParameterWithLocation("simple", false, "userId", runtime.ParamLocationPath, ctx.Param("userId"), &userId)
	if err != nil {
		return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter userId: %s", err))
	}

	ctx.Set(BearerScopes, []string{})

	// Invoke the callback with all the unmarshaled arguments
	err = w.Handler.SetAccountVerificationStatus(ctx, userId)
	return err
}

// PaginationAccounts converts echo context to params.
func (w *ServerInterfaceWrapper) PaginationAccounts(ctx echo.Context) error {
	var err error

	// Parameter object where we will unmarshal all parameters from the context
	var params PaginationAccountsParams
	// ------------- Optional query parameter "page" -------------

	err = runtime.BindQueryParameter("form", false, false, "page", ctx.QueryParams(), &params.Page)
	if err != nil {
		return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter page: %s", err))
	}

	// ------------- Optional query parameter "limit" -------------

	err = runtime.BindQueryParameter("form", false, false, "limit", ctx.QueryParams(), &params.Limit)
	if err != nil {
		return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err))
	}

	// Invoke the callback with all the unmarshaled arguments
	err = w.Handler.PaginationAccounts(ctx, params)
	return err
}

// RemoveFromCart converts echo context to params.
func (w *ServerInterfaceWrapper) RemoveFromCart(ctx echo.Context) error {
	var err error

	ctx.Set(BearerScopes, []string{})

	// Parameter object where we will unmarshal all parameters from the context
	var params RemoveFromCartParams
	// ------------- Required query parameter "id" -------------

	err = runtime.BindQueryParameter("form", true, true, "id", ctx.QueryParams(), &params.Id)
	if err != nil {
		return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
	}

	// Invoke the callback with all the unmarshaled arguments
	err = w.Handler.RemoveFromCart(ctx, params)
	return err
}

// Add2cart converts echo context to params.
func (w *ServerInterfaceWrapper) Add2cart(ctx echo.Context) error {
	var err error

	ctx.Set(BearerScopes, []string{})

	// Parameter object where we will unmarshal all parameters from the context
	var params Add2cartParams
	// ------------- Required query parameter "id" -------------

	err = runtime.BindQueryParameter("form", true, true, "id", ctx.QueryParams(), &params.Id)
	if err != nil {
		return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter id: %s", err))
	}

	// Invoke the callback with all the unmarshaled arguments
	err = w.Handler.Add2cart(ctx, params)
	return err
}

// PayCart converts echo context to params.
func (w *ServerInterfaceWrapper) PayCart(ctx echo.Context) error {
	var err error

	ctx.Set(BearerScopes, []string{})

	// Invoke the callback with all the unmarshaled arguments
	err = w.Handler.PayCart(ctx)
	return err
}

// GetCurrencies converts echo context to params.
func (w *ServerInterfaceWrapper) GetCurrencies(ctx echo.Context) error {
	var err error

	// Invoke the callback with all the unmarshaled arguments
	err = w.Handler.GetCurrencies(ctx)
	return err
}

// UpdateCurrencies converts echo context to params.
func (w *ServerInterfaceWrapper) UpdateCurrencies(ctx echo.Context) error {
	var err error

	ctx.Set(BearerScopes, []string{})

	// Invoke the callback with all the unmarshaled arguments
	err = w.Handler.UpdateCurrencies(ctx)
	return err
}

// GetHistory converts echo context to params.
func (w *ServerInterfaceWrapper) GetHistory(ctx echo.Context) error {
	var err error

	ctx.Set(BearerScopes, []string{})

	// Parameter object where we will unmarshal all parameters from the context
	var params GetHistoryParams
	// ------------- Optional query parameter "page" -------------

	err = runtime.BindQueryParameter("form", false, false, "page", ctx.QueryParams(), &params.Page)
	if err != nil {
		return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter page: %s", err))
	}

	// ------------- Optional query parameter "limit" -------------

	err = runtime.BindQueryParameter("form", false, false, "limit", ctx.QueryParams(), &params.Limit)
	if err != nil {
		return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter limit: %s", err))
	}

	// ------------- Optional query parameter "type" -------------

	err = runtime.BindQueryParameter("form", false, false, "type", ctx.QueryParams(), &params.Type)
	if err != nil {
		return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter type: %s", err))
	}

	// ------------- Optional query parameter "accountID" -------------

	err = runtime.BindQueryParameter("form", false, false, "accountID", ctx.QueryParams(), &params.AccountID)
	if err != nil {
		return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Invalid format for parameter accountID: %s", err))
	}

	// Invoke the callback with all the unmarshaled arguments
	err = w.Handler.GetHistory(ctx, params)
	return err
}

// CalculateLTV converts echo context to params.
func (w *ServerInterfaceWrapper) CalculateLTV(ctx echo.Context) error {
	var err error

	ctx.Set(BearerScopes, []string{})

	// Invoke the callback with all the unmarshaled arguments
	err = w.Handler.CalculateLTV(ctx)
	return err
}

// GetRecentTariffs converts echo context to params.
func (w *ServerInterfaceWrapper) GetRecentTariffs(ctx echo.Context) error {
	var err error

	ctx.Set(BearerScopes, []string{})

	// Invoke the callback with all the unmarshaled arguments
	err = w.Handler.GetRecentTariffs(ctx)
	return err
}

// SendReport converts echo context to params.
func (w *ServerInterfaceWrapper) SendReport(ctx echo.Context) error {
	var err error

	ctx.Set(BearerScopes, []string{})

	// Invoke the callback with all the unmarshaled arguments
	err = w.Handler.SendReport(ctx)
	return err
}

// ChangeCurrency converts echo context to params.
func (w *ServerInterfaceWrapper) ChangeCurrency(ctx echo.Context) error {
	var err error

	ctx.Set(BearerScopes, []string{})

	// Invoke the callback with all the unmarshaled arguments
	err = w.Handler.ChangeCurrency(ctx)
	return err
}

// RequestMoney converts echo context to params.
func (w *ServerInterfaceWrapper) RequestMoney(ctx echo.Context) error {
	var err error

	ctx.Set(BearerScopes, []string{})

	// Invoke the callback with all the unmarshaled arguments
	err = w.Handler.RequestMoney(ctx)
	return err
}

// This is a simple interface which specifies echo.Route addition functions which
// are present on both echo.Echo and echo.Group, since we want to allow using
// either of them for path registration
type EchoRouter interface {
	CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}

// RegisterHandlers adds each server route to the EchoRouter.
func RegisterHandlers(router EchoRouter, si ServerInterface) {
	RegisterHandlersWithBaseURL(router, si, "")
}

// Registers handlers, and prepends BaseURL to the paths, so that the paths
// can be served under a prefix.
func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string) {

	wrapper := ServerInterfaceWrapper{
		Handler: si,
	}

	router.DELETE(baseURL+"/account", wrapper.DeleteAccount)
	router.GET(baseURL+"/account", wrapper.GetAccount)
	router.PATCH(baseURL+"/account", wrapper.ChangeAccount)
	router.POST(baseURL+"/account", wrapper.AddAccount)
	router.DELETE(baseURL+"/account/:userId", wrapper.DeleteDirectAccount)
	router.GET(baseURL+"/account/:userId", wrapper.GetDirectAccount)
	router.PATCH(baseURL+"/account/:userId", wrapper.SetAccountVerificationStatus)
	router.GET(baseURL+"/accounts", wrapper.PaginationAccounts)
	router.DELETE(baseURL+"/cart", wrapper.RemoveFromCart)
	router.PATCH(baseURL+"/cart", wrapper.Add2cart)
	router.POST(baseURL+"/cart/pay", wrapper.PayCart)
	router.GET(baseURL+"/currencies", wrapper.GetCurrencies)
	router.PUT(baseURL+"/currencies", wrapper.UpdateCurrencies)
	router.GET(baseURL+"/history", wrapper.GetHistory)
	router.POST(baseURL+"/history/ltv", wrapper.CalculateLTV)
	router.GET(baseURL+"/recent", wrapper.GetRecentTariffs)
	router.POST(baseURL+"/sendReport", wrapper.SendReport)
	router.PATCH(baseURL+"/wallet", wrapper.ChangeCurrency)
	router.POST(baseURL+"/wallet", wrapper.RequestMoney)

}

// Base64 encoded, gzipped, json marshaled Swagger object
var swaggerSpec = []string{

	"H4sIAAAAAAAC/+xcbXMbR3L+K1ObfLArKxCk6ejMbzLlS5Q6+1x6c6lE1t0SGJB7Anbh3YVtxoUqEvCJ",
	"VpEWI+dScV0s+ey7qnxLQIgQQRIA/0LPP0p1z+z7gAQpihJj31XJILC709PT/fTTPT37pVFya3XX4U7g",
	"G3NfGn5phdcs+nitVHIbToAf655b515gc/rhd3YZ/8O/sGr1KjfmjF8Vr1amK1evLpUqv5oula++997s",
	"O+8Vp6cN0whW63iFH3i2s2w0TaNkeUHq7vvH3T7mpxlj0TTsgNdIntwY6gvL86xVGtPjVsDL12jgiuvV",
	"rMCYM8pWwK8Edo3rxCzzKj/lLbZ/Xd6Uml7Fqvo8unrJdavccvByx6pxvPLvPV4x5oy/m4oXYkqtwtRH",
	"eE3TNPzAChr+SVerBbslL26aRqNePu28Gz73brzE8n5uVas8OEnST+RVzaZpePzThu2h0u6TYUUiKFOJ",
	"Hqk0FikjWiMjucDJSS9G8rlLf+ClAOVL6win6TRqOLbj4ggP8F/XW07cG8/tfct5MG955bxHlCyvvOJW",
	"y9zDv8rcL3l2PbBdx5gz4DsYiG0GXTiEDuxCDw7FlngIHQYH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e6HMLVtw2EijxPtU6CmpulC1x0YQkk/DyQ6KCVNyy9z",
	"lDl7bE3tUVlRQ2TuDvVWB9GGo5DZpt8Sox4R2aHmGYluC0L/8Bb0jDGXR4Q0vlxNUHNDokJF23LqhjCf",
	"aC42/y8AAP//Dabnb25UAAA=",
}

// GetSwagger returns the content of the embedded swagger specification file
// or error if failed to decode
func decodeSpec() ([]byte, error) {
	zipped, err := base64.StdEncoding.DecodeString(strings.Join(swaggerSpec, ""))
	if err != nil {
		return nil, fmt.Errorf("error base64 decoding spec: %w", err)
	}
	zr, err := gzip.NewReader(bytes.NewReader(zipped))
	if err != nil {
		return nil, fmt.Errorf("error decompressing spec: %w", err)
	}
	var buf bytes.Buffer
	_, err = buf.ReadFrom(zr)
	if err != nil {
		return nil, fmt.Errorf("error decompressing spec: %w", err)
	}

	return buf.Bytes(), nil
}

var rawSpec = decodeSpecCached()

// a naive cached of a decoded swagger 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
}

// GetSwagger returns the Swagger specification corresponding to the generated code
// in this file. The external references of Swagger specification are resolved.
// The logic of resolving external references is tightly connected to "import-mapping" feature.
// Externally referenced files must be embedded in the corresponding golang packages.
// Urls can be supported but this task was out of the scope.
func GetSwagger() (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
}
