// Code generated by ogen, DO NOT EDIT.

package api

import (
	"net/http"
	"net/url"

	"github.com/go-faster/errors"

	"github.com/ogen-go/ogen/conv"
	"github.com/ogen-go/ogen/middleware"
	"github.com/ogen-go/ogen/ogenerrors"
	"github.com/ogen-go/ogen/uri"
	"github.com/ogen-go/ogen/validate"
)

// APIV2BufferGoodsTaskGetParams is parameters of GET /api/v2/buffer/goods/task operation.
type APIV2BufferGoodsTaskGetParams struct {
	// Сколько элементов вывести на одной странице
	// (пагинация). Максимум 1 000 элементов.
	Limit uint
	// После какого элемента выдавать данные.
	Offset OptUint
	// ID загрузки.
	UploadID int
}

func unpackAPIV2BufferGoodsTaskGetParams(packed middleware.Parameters) (params APIV2BufferGoodsTaskGetParams) {
	{
		key := middleware.ParameterKey{
			Name: "limit",
			In:   "query",
		}
		params.Limit = packed[key].(uint)
	}
	{
		key := middleware.ParameterKey{
			Name: "offset",
			In:   "query",
		}
		if v, ok := packed[key]; ok {
			params.Offset = v.(OptUint)
		}
	}
	{
		key := middleware.ParameterKey{
			Name: "uploadID",
			In:   "query",
		}
		params.UploadID = packed[key].(int)
	}
	return params
}

func decodeAPIV2BufferGoodsTaskGetParams(args [0]string, argsEscaped bool, r *http.Request) (params APIV2BufferGoodsTaskGetParams, _ error) {
	q := uri.NewQueryDecoder(r.URL.Query())
	// Decode query: limit.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "limit",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				val, err := d.DecodeValue()
				if err != nil {
					return err
				}

				c, err := conv.ToUint(val)
				if err != nil {
					return err
				}

				params.Limit = c
				return nil
			}); err != nil {
				return err
			}
		} else {
			return err
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "limit",
			In:   "query",
			Err:  err,
		}
	}
	// Decode query: offset.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "offset",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				var paramsDotOffsetVal uint
				if err := func() error {
					val, err := d.DecodeValue()
					if err != nil {
						return err
					}

					c, err := conv.ToUint(val)
					if err != nil {
						return err
					}

					paramsDotOffsetVal = c
					return nil
				}(); err != nil {
					return err
				}
				params.Offset.SetTo(paramsDotOffsetVal)
				return nil
			}); err != nil {
				return err
			}
			if err := func() error {
				if value, ok := params.Offset.Get(); ok {
					if err := func() error {
						if err := (validate.Int{
							MinSet:        true,
							Min:           0,
							MaxSet:        false,
							Max:           0,
							MinExclusive:  false,
							MaxExclusive:  false,
							MultipleOfSet: false,
							MultipleOf:    0,
						}).Validate(int64(value)); err != nil {
							return errors.Wrap(err, "int")
						}
						return nil
					}(); err != nil {
						return err
					}
				}
				return nil
			}(); err != nil {
				return err
			}
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "offset",
			In:   "query",
			Err:  err,
		}
	}
	// Decode query: uploadID.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "uploadID",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				val, err := d.DecodeValue()
				if err != nil {
					return err
				}

				c, err := conv.ToInt(val)
				if err != nil {
					return err
				}

				params.UploadID = c
				return nil
			}); err != nil {
				return err
			}
		} else {
			return err
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "uploadID",
			In:   "query",
			Err:  err,
		}
	}
	return params, nil
}

// APIV2BufferTasksGetParams is parameters of GET /api/v2/buffer/tasks operation.
type APIV2BufferTasksGetParams struct {
	// ID загрузки.
	UploadID int
}

func unpackAPIV2BufferTasksGetParams(packed middleware.Parameters) (params APIV2BufferTasksGetParams) {
	{
		key := middleware.ParameterKey{
			Name: "uploadID",
			In:   "query",
		}
		params.UploadID = packed[key].(int)
	}
	return params
}

func decodeAPIV2BufferTasksGetParams(args [0]string, argsEscaped bool, r *http.Request) (params APIV2BufferTasksGetParams, _ error) {
	q := uri.NewQueryDecoder(r.URL.Query())
	// Decode query: uploadID.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "uploadID",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				val, err := d.DecodeValue()
				if err != nil {
					return err
				}

				c, err := conv.ToInt(val)
				if err != nil {
					return err
				}

				params.UploadID = c
				return nil
			}); err != nil {
				return err
			}
		} else {
			return err
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "uploadID",
			In:   "query",
			Err:  err,
		}
	}
	return params, nil
}

// APIV2HistoryGoodsTaskGetParams is parameters of GET /api/v2/history/goods/task operation.
type APIV2HistoryGoodsTaskGetParams struct {
	// Сколько элементов вывести на одной странице
	// (пагинация). Максимум 1 000 элементов.
	Limit uint
	// После какого элемента выдавать данные.
	Offset OptUint
	// ID загрузки.
	UploadID int
}

func unpackAPIV2HistoryGoodsTaskGetParams(packed middleware.Parameters) (params APIV2HistoryGoodsTaskGetParams) {
	{
		key := middleware.ParameterKey{
			Name: "limit",
			In:   "query",
		}
		params.Limit = packed[key].(uint)
	}
	{
		key := middleware.ParameterKey{
			Name: "offset",
			In:   "query",
		}
		if v, ok := packed[key]; ok {
			params.Offset = v.(OptUint)
		}
	}
	{
		key := middleware.ParameterKey{
			Name: "uploadID",
			In:   "query",
		}
		params.UploadID = packed[key].(int)
	}
	return params
}

func decodeAPIV2HistoryGoodsTaskGetParams(args [0]string, argsEscaped bool, r *http.Request) (params APIV2HistoryGoodsTaskGetParams, _ error) {
	q := uri.NewQueryDecoder(r.URL.Query())
	// Decode query: limit.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "limit",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				val, err := d.DecodeValue()
				if err != nil {
					return err
				}

				c, err := conv.ToUint(val)
				if err != nil {
					return err
				}

				params.Limit = c
				return nil
			}); err != nil {
				return err
			}
		} else {
			return err
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "limit",
			In:   "query",
			Err:  err,
		}
	}
	// Decode query: offset.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "offset",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				var paramsDotOffsetVal uint
				if err := func() error {
					val, err := d.DecodeValue()
					if err != nil {
						return err
					}

					c, err := conv.ToUint(val)
					if err != nil {
						return err
					}

					paramsDotOffsetVal = c
					return nil
				}(); err != nil {
					return err
				}
				params.Offset.SetTo(paramsDotOffsetVal)
				return nil
			}); err != nil {
				return err
			}
			if err := func() error {
				if value, ok := params.Offset.Get(); ok {
					if err := func() error {
						if err := (validate.Int{
							MinSet:        true,
							Min:           0,
							MaxSet:        false,
							Max:           0,
							MinExclusive:  false,
							MaxExclusive:  false,
							MultipleOfSet: false,
							MultipleOf:    0,
						}).Validate(int64(value)); err != nil {
							return errors.Wrap(err, "int")
						}
						return nil
					}(); err != nil {
						return err
					}
				}
				return nil
			}(); err != nil {
				return err
			}
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "offset",
			In:   "query",
			Err:  err,
		}
	}
	// Decode query: uploadID.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "uploadID",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				val, err := d.DecodeValue()
				if err != nil {
					return err
				}

				c, err := conv.ToInt(val)
				if err != nil {
					return err
				}

				params.UploadID = c
				return nil
			}); err != nil {
				return err
			}
		} else {
			return err
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "uploadID",
			In:   "query",
			Err:  err,
		}
	}
	return params, nil
}

// APIV2HistoryTasksGetParams is parameters of GET /api/v2/history/tasks operation.
type APIV2HistoryTasksGetParams struct {
	// ID загрузки.
	UploadID int
}

func unpackAPIV2HistoryTasksGetParams(packed middleware.Parameters) (params APIV2HistoryTasksGetParams) {
	{
		key := middleware.ParameterKey{
			Name: "uploadID",
			In:   "query",
		}
		params.UploadID = packed[key].(int)
	}
	return params
}

func decodeAPIV2HistoryTasksGetParams(args [0]string, argsEscaped bool, r *http.Request) (params APIV2HistoryTasksGetParams, _ error) {
	q := uri.NewQueryDecoder(r.URL.Query())
	// Decode query: uploadID.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "uploadID",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				val, err := d.DecodeValue()
				if err != nil {
					return err
				}

				c, err := conv.ToInt(val)
				if err != nil {
					return err
				}

				params.UploadID = c
				return nil
			}); err != nil {
				return err
			}
		} else {
			return err
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "uploadID",
			In:   "query",
			Err:  err,
		}
	}
	return params, nil
}

// APIV2ListGoodsFilterGetParams is parameters of GET /api/v2/list/goods/filter operation.
type APIV2ListGoodsFilterGetParams struct {
	// Сколько элементов вывести на одной странице
	// (пагинация). Максимум 1 000 элементов.
	Limit uint
	// После какого элемента выдавать данные.
	Offset OptUint
	// Артикул WB, по которому искать товар.
	FilterNmID OptInt
}

func unpackAPIV2ListGoodsFilterGetParams(packed middleware.Parameters) (params APIV2ListGoodsFilterGetParams) {
	{
		key := middleware.ParameterKey{
			Name: "limit",
			In:   "query",
		}
		params.Limit = packed[key].(uint)
	}
	{
		key := middleware.ParameterKey{
			Name: "offset",
			In:   "query",
		}
		if v, ok := packed[key]; ok {
			params.Offset = v.(OptUint)
		}
	}
	{
		key := middleware.ParameterKey{
			Name: "filterNmID",
			In:   "query",
		}
		if v, ok := packed[key]; ok {
			params.FilterNmID = v.(OptInt)
		}
	}
	return params
}

func decodeAPIV2ListGoodsFilterGetParams(args [0]string, argsEscaped bool, r *http.Request) (params APIV2ListGoodsFilterGetParams, _ error) {
	q := uri.NewQueryDecoder(r.URL.Query())
	// Decode query: limit.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "limit",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				val, err := d.DecodeValue()
				if err != nil {
					return err
				}

				c, err := conv.ToUint(val)
				if err != nil {
					return err
				}

				params.Limit = c
				return nil
			}); err != nil {
				return err
			}
		} else {
			return err
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "limit",
			In:   "query",
			Err:  err,
		}
	}
	// Decode query: offset.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "offset",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				var paramsDotOffsetVal uint
				if err := func() error {
					val, err := d.DecodeValue()
					if err != nil {
						return err
					}

					c, err := conv.ToUint(val)
					if err != nil {
						return err
					}

					paramsDotOffsetVal = c
					return nil
				}(); err != nil {
					return err
				}
				params.Offset.SetTo(paramsDotOffsetVal)
				return nil
			}); err != nil {
				return err
			}
			if err := func() error {
				if value, ok := params.Offset.Get(); ok {
					if err := func() error {
						if err := (validate.Int{
							MinSet:        true,
							Min:           0,
							MaxSet:        false,
							Max:           0,
							MinExclusive:  false,
							MaxExclusive:  false,
							MultipleOfSet: false,
							MultipleOf:    0,
						}).Validate(int64(value)); err != nil {
							return errors.Wrap(err, "int")
						}
						return nil
					}(); err != nil {
						return err
					}
				}
				return nil
			}(); err != nil {
				return err
			}
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "offset",
			In:   "query",
			Err:  err,
		}
	}
	// Decode query: filterNmID.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "filterNmID",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				var paramsDotFilterNmIDVal int
				if err := func() error {
					val, err := d.DecodeValue()
					if err != nil {
						return err
					}

					c, err := conv.ToInt(val)
					if err != nil {
						return err
					}

					paramsDotFilterNmIDVal = c
					return nil
				}(); err != nil {
					return err
				}
				params.FilterNmID.SetTo(paramsDotFilterNmIDVal)
				return nil
			}); err != nil {
				return err
			}
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "filterNmID",
			In:   "query",
			Err:  err,
		}
	}
	return params, nil
}

// APIV2ListGoodsSizeNmGetParams is parameters of GET /api/v2/list/goods/size/nm operation.
type APIV2ListGoodsSizeNmGetParams struct {
	// Сколько элементов вывести на одной странице
	// (пагинация). Максимум 1 000 элементов.
	Limit uint
	// После какого элемента выдавать данные.
	Offset OptUint
	// Артикул WB.
	NmID int
}

func unpackAPIV2ListGoodsSizeNmGetParams(packed middleware.Parameters) (params APIV2ListGoodsSizeNmGetParams) {
	{
		key := middleware.ParameterKey{
			Name: "limit",
			In:   "query",
		}
		params.Limit = packed[key].(uint)
	}
	{
		key := middleware.ParameterKey{
			Name: "offset",
			In:   "query",
		}
		if v, ok := packed[key]; ok {
			params.Offset = v.(OptUint)
		}
	}
	{
		key := middleware.ParameterKey{
			Name: "nmID",
			In:   "query",
		}
		params.NmID = packed[key].(int)
	}
	return params
}

func decodeAPIV2ListGoodsSizeNmGetParams(args [0]string, argsEscaped bool, r *http.Request) (params APIV2ListGoodsSizeNmGetParams, _ error) {
	q := uri.NewQueryDecoder(r.URL.Query())
	// Decode query: limit.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "limit",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				val, err := d.DecodeValue()
				if err != nil {
					return err
				}

				c, err := conv.ToUint(val)
				if err != nil {
					return err
				}

				params.Limit = c
				return nil
			}); err != nil {
				return err
			}
		} else {
			return err
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "limit",
			In:   "query",
			Err:  err,
		}
	}
	// Decode query: offset.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "offset",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				var paramsDotOffsetVal uint
				if err := func() error {
					val, err := d.DecodeValue()
					if err != nil {
						return err
					}

					c, err := conv.ToUint(val)
					if err != nil {
						return err
					}

					paramsDotOffsetVal = c
					return nil
				}(); err != nil {
					return err
				}
				params.Offset.SetTo(paramsDotOffsetVal)
				return nil
			}); err != nil {
				return err
			}
			if err := func() error {
				if value, ok := params.Offset.Get(); ok {
					if err := func() error {
						if err := (validate.Int{
							MinSet:        true,
							Min:           0,
							MaxSet:        false,
							Max:           0,
							MinExclusive:  false,
							MaxExclusive:  false,
							MultipleOfSet: false,
							MultipleOf:    0,
						}).Validate(int64(value)); err != nil {
							return errors.Wrap(err, "int")
						}
						return nil
					}(); err != nil {
						return err
					}
				}
				return nil
			}(); err != nil {
				return err
			}
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "offset",
			In:   "query",
			Err:  err,
		}
	}
	// Decode query: nmID.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "nmID",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				val, err := d.DecodeValue()
				if err != nil {
					return err
				}

				c, err := conv.ToInt(val)
				if err != nil {
					return err
				}

				params.NmID = c
				return nil
			}); err != nil {
				return err
			}
		} else {
			return err
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "nmID",
			In:   "query",
			Err:  err,
		}
	}
	return params, nil
}

// APIV2QuarantineGoodsGetParams is parameters of GET /api/v2/quarantine/goods operation.
type APIV2QuarantineGoodsGetParams struct {
	// Сколько элементов вывести на одной странице
	// (пагинация). Максимум 1 000 элементов.
	Limit uint
	// После какого элемента выдавать данные.
	Offset OptUint
}

func unpackAPIV2QuarantineGoodsGetParams(packed middleware.Parameters) (params APIV2QuarantineGoodsGetParams) {
	{
		key := middleware.ParameterKey{
			Name: "limit",
			In:   "query",
		}
		params.Limit = packed[key].(uint)
	}
	{
		key := middleware.ParameterKey{
			Name: "offset",
			In:   "query",
		}
		if v, ok := packed[key]; ok {
			params.Offset = v.(OptUint)
		}
	}
	return params
}

func decodeAPIV2QuarantineGoodsGetParams(args [0]string, argsEscaped bool, r *http.Request) (params APIV2QuarantineGoodsGetParams, _ error) {
	q := uri.NewQueryDecoder(r.URL.Query())
	// Decode query: limit.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "limit",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				val, err := d.DecodeValue()
				if err != nil {
					return err
				}

				c, err := conv.ToUint(val)
				if err != nil {
					return err
				}

				params.Limit = c
				return nil
			}); err != nil {
				return err
			}
		} else {
			return err
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "limit",
			In:   "query",
			Err:  err,
		}
	}
	// Decode query: offset.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "offset",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				var paramsDotOffsetVal uint
				if err := func() error {
					val, err := d.DecodeValue()
					if err != nil {
						return err
					}

					c, err := conv.ToUint(val)
					if err != nil {
						return err
					}

					paramsDotOffsetVal = c
					return nil
				}(); err != nil {
					return err
				}
				params.Offset.SetTo(paramsDotOffsetVal)
				return nil
			}); err != nil {
				return err
			}
			if err := func() error {
				if value, ok := params.Offset.Get(); ok {
					if err := func() error {
						if err := (validate.Int{
							MinSet:        true,
							Min:           0,
							MaxSet:        false,
							Max:           0,
							MinExclusive:  false,
							MaxExclusive:  false,
							MultipleOfSet: false,
							MultipleOf:    0,
						}).Validate(int64(value)); err != nil {
							return errors.Wrap(err, "int")
						}
						return nil
					}(); err != nil {
						return err
					}
				}
				return nil
			}(); err != nil {
				return err
			}
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "offset",
			In:   "query",
			Err:  err,
		}
	}
	return params, nil
}

// APIV3StocksWarehouseIdDeleteParams is parameters of DELETE /api/v3/stocks/{warehouseId} operation.
type APIV3StocksWarehouseIdDeleteParams struct {
	// ID склада продавца.
	WarehouseId int64
}

func unpackAPIV3StocksWarehouseIdDeleteParams(packed middleware.Parameters) (params APIV3StocksWarehouseIdDeleteParams) {
	{
		key := middleware.ParameterKey{
			Name: "warehouseId",
			In:   "path",
		}
		params.WarehouseId = packed[key].(int64)
	}
	return params
}

func decodeAPIV3StocksWarehouseIdDeleteParams(args [1]string, argsEscaped bool, r *http.Request) (params APIV3StocksWarehouseIdDeleteParams, _ error) {
	// Decode path: warehouseId.
	if err := func() error {
		param := args[0]
		if argsEscaped {
			unescaped, err := url.PathUnescape(args[0])
			if err != nil {
				return errors.Wrap(err, "unescape path")
			}
			param = unescaped
		}
		if len(param) > 0 {
			d := uri.NewPathDecoder(uri.PathDecoderConfig{
				Param:   "warehouseId",
				Value:   param,
				Style:   uri.PathStyleSimple,
				Explode: false,
			})

			if err := func() error {
				val, err := d.DecodeValue()
				if err != nil {
					return err
				}

				c, err := conv.ToInt64(val)
				if err != nil {
					return err
				}

				params.WarehouseId = c
				return nil
			}(); err != nil {
				return err
			}
		} else {
			return validate.ErrFieldRequired
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "warehouseId",
			In:   "path",
			Err:  err,
		}
	}
	return params, nil
}

// APIV3StocksWarehouseIdPostParams is parameters of POST /api/v3/stocks/{warehouseId} operation.
type APIV3StocksWarehouseIdPostParams struct {
	// ID склада продавца.
	WarehouseId int64
}

func unpackAPIV3StocksWarehouseIdPostParams(packed middleware.Parameters) (params APIV3StocksWarehouseIdPostParams) {
	{
		key := middleware.ParameterKey{
			Name: "warehouseId",
			In:   "path",
		}
		params.WarehouseId = packed[key].(int64)
	}
	return params
}

func decodeAPIV3StocksWarehouseIdPostParams(args [1]string, argsEscaped bool, r *http.Request) (params APIV3StocksWarehouseIdPostParams, _ error) {
	// Decode path: warehouseId.
	if err := func() error {
		param := args[0]
		if argsEscaped {
			unescaped, err := url.PathUnescape(args[0])
			if err != nil {
				return errors.Wrap(err, "unescape path")
			}
			param = unescaped
		}
		if len(param) > 0 {
			d := uri.NewPathDecoder(uri.PathDecoderConfig{
				Param:   "warehouseId",
				Value:   param,
				Style:   uri.PathStyleSimple,
				Explode: false,
			})

			if err := func() error {
				val, err := d.DecodeValue()
				if err != nil {
					return err
				}

				c, err := conv.ToInt64(val)
				if err != nil {
					return err
				}

				params.WarehouseId = c
				return nil
			}(); err != nil {
				return err
			}
		} else {
			return validate.ErrFieldRequired
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "warehouseId",
			In:   "path",
			Err:  err,
		}
	}
	return params, nil
}

// APIV3StocksWarehouseIdPutParams is parameters of PUT /api/v3/stocks/{warehouseId} operation.
type APIV3StocksWarehouseIdPutParams struct {
	// ID склада продавца.
	WarehouseId int64
}

func unpackAPIV3StocksWarehouseIdPutParams(packed middleware.Parameters) (params APIV3StocksWarehouseIdPutParams) {
	{
		key := middleware.ParameterKey{
			Name: "warehouseId",
			In:   "path",
		}
		params.WarehouseId = packed[key].(int64)
	}
	return params
}

func decodeAPIV3StocksWarehouseIdPutParams(args [1]string, argsEscaped bool, r *http.Request) (params APIV3StocksWarehouseIdPutParams, _ error) {
	// Decode path: warehouseId.
	if err := func() error {
		param := args[0]
		if argsEscaped {
			unescaped, err := url.PathUnescape(args[0])
			if err != nil {
				return errors.Wrap(err, "unescape path")
			}
			param = unescaped
		}
		if len(param) > 0 {
			d := uri.NewPathDecoder(uri.PathDecoderConfig{
				Param:   "warehouseId",
				Value:   param,
				Style:   uri.PathStyleSimple,
				Explode: false,
			})

			if err := func() error {
				val, err := d.DecodeValue()
				if err != nil {
					return err
				}

				c, err := conv.ToInt64(val)
				if err != nil {
					return err
				}

				params.WarehouseId = c
				return nil
			}(); err != nil {
				return err
			}
		} else {
			return validate.ErrFieldRequired
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "warehouseId",
			In:   "path",
			Err:  err,
		}
	}
	return params, nil
}

// APIV3WarehousesWarehouseIdDeleteParams is parameters of DELETE /api/v3/warehouses/{warehouseId} operation.
type APIV3WarehousesWarehouseIdDeleteParams struct {
	// ID склада продавца.
	WarehouseId int64
}

func unpackAPIV3WarehousesWarehouseIdDeleteParams(packed middleware.Parameters) (params APIV3WarehousesWarehouseIdDeleteParams) {
	{
		key := middleware.ParameterKey{
			Name: "warehouseId",
			In:   "path",
		}
		params.WarehouseId = packed[key].(int64)
	}
	return params
}

func decodeAPIV3WarehousesWarehouseIdDeleteParams(args [1]string, argsEscaped bool, r *http.Request) (params APIV3WarehousesWarehouseIdDeleteParams, _ error) {
	// Decode path: warehouseId.
	if err := func() error {
		param := args[0]
		if argsEscaped {
			unescaped, err := url.PathUnescape(args[0])
			if err != nil {
				return errors.Wrap(err, "unescape path")
			}
			param = unescaped
		}
		if len(param) > 0 {
			d := uri.NewPathDecoder(uri.PathDecoderConfig{
				Param:   "warehouseId",
				Value:   param,
				Style:   uri.PathStyleSimple,
				Explode: false,
			})

			if err := func() error {
				val, err := d.DecodeValue()
				if err != nil {
					return err
				}

				c, err := conv.ToInt64(val)
				if err != nil {
					return err
				}

				params.WarehouseId = c
				return nil
			}(); err != nil {
				return err
			}
		} else {
			return validate.ErrFieldRequired
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "warehouseId",
			In:   "path",
			Err:  err,
		}
	}
	return params, nil
}

// APIV3WarehousesWarehouseIdPutParams is parameters of PUT /api/v3/warehouses/{warehouseId} operation.
type APIV3WarehousesWarehouseIdPutParams struct {
	// ID склада продавца.
	WarehouseId int64
}

func unpackAPIV3WarehousesWarehouseIdPutParams(packed middleware.Parameters) (params APIV3WarehousesWarehouseIdPutParams) {
	{
		key := middleware.ParameterKey{
			Name: "warehouseId",
			In:   "path",
		}
		params.WarehouseId = packed[key].(int64)
	}
	return params
}

func decodeAPIV3WarehousesWarehouseIdPutParams(args [1]string, argsEscaped bool, r *http.Request) (params APIV3WarehousesWarehouseIdPutParams, _ error) {
	// Decode path: warehouseId.
	if err := func() error {
		param := args[0]
		if argsEscaped {
			unescaped, err := url.PathUnescape(args[0])
			if err != nil {
				return errors.Wrap(err, "unescape path")
			}
			param = unescaped
		}
		if len(param) > 0 {
			d := uri.NewPathDecoder(uri.PathDecoderConfig{
				Param:   "warehouseId",
				Value:   param,
				Style:   uri.PathStyleSimple,
				Explode: false,
			})

			if err := func() error {
				val, err := d.DecodeValue()
				if err != nil {
					return err
				}

				c, err := conv.ToInt64(val)
				if err != nil {
					return err
				}

				params.WarehouseId = c
				return nil
			}(); err != nil {
				return err
			}
		} else {
			return validate.ErrFieldRequired
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "warehouseId",
			In:   "path",
			Err:  err,
		}
	}
	return params, nil
}

// ContentV2CardsErrorListGetParams is parameters of GET /content/v2/cards/error/list operation.
type ContentV2CardsErrorListGetParams struct {
	// Параметр выбора языка значений полей ответа (для
	// которых предусмотрена мультиязычность).
	// Не используется в песочнице.
	Locale OptString
}

func unpackContentV2CardsErrorListGetParams(packed middleware.Parameters) (params ContentV2CardsErrorListGetParams) {
	{
		key := middleware.ParameterKey{
			Name: "locale",
			In:   "query",
		}
		if v, ok := packed[key]; ok {
			params.Locale = v.(OptString)
		}
	}
	return params
}

func decodeContentV2CardsErrorListGetParams(args [0]string, argsEscaped bool, r *http.Request) (params ContentV2CardsErrorListGetParams, _ error) {
	q := uri.NewQueryDecoder(r.URL.Query())
	// Decode query: locale.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "locale",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				var paramsDotLocaleVal string
				if err := func() error {
					val, err := d.DecodeValue()
					if err != nil {
						return err
					}

					c, err := conv.ToString(val)
					if err != nil {
						return err
					}

					paramsDotLocaleVal = c
					return nil
				}(); err != nil {
					return err
				}
				params.Locale.SetTo(paramsDotLocaleVal)
				return nil
			}); err != nil {
				return err
			}
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "locale",
			In:   "query",
			Err:  err,
		}
	}
	return params, nil
}

// ContentV2DirectoryColorsGetParams is parameters of GET /content/v2/directory/colors operation.
type ContentV2DirectoryColorsGetParams struct {
	// Язык полей ответа `subjectName` и `name`:
	// - `ru` — русский
	// - `en` — английский
	// - `zh` — китайский
	// Не используется в песочнице.
	Locale OptString
}

func unpackContentV2DirectoryColorsGetParams(packed middleware.Parameters) (params ContentV2DirectoryColorsGetParams) {
	{
		key := middleware.ParameterKey{
			Name: "locale",
			In:   "query",
		}
		if v, ok := packed[key]; ok {
			params.Locale = v.(OptString)
		}
	}
	return params
}

func decodeContentV2DirectoryColorsGetParams(args [0]string, argsEscaped bool, r *http.Request) (params ContentV2DirectoryColorsGetParams, _ error) {
	q := uri.NewQueryDecoder(r.URL.Query())
	// Decode query: locale.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "locale",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				var paramsDotLocaleVal string
				if err := func() error {
					val, err := d.DecodeValue()
					if err != nil {
						return err
					}

					c, err := conv.ToString(val)
					if err != nil {
						return err
					}

					paramsDotLocaleVal = c
					return nil
				}(); err != nil {
					return err
				}
				params.Locale.SetTo(paramsDotLocaleVal)
				return nil
			}); err != nil {
				return err
			}
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "locale",
			In:   "query",
			Err:  err,
		}
	}
	return params, nil
}

// ContentV2DirectoryCountriesGetParams is parameters of GET /content/v2/directory/countries operation.
type ContentV2DirectoryCountriesGetParams struct {
	// Язык полей ответа `subjectName` и `name`:
	// - `ru` — русский
	// - `en` — английский
	// - `zh` — китайский
	// Не используется в песочнице.
	Locale OptString
}

func unpackContentV2DirectoryCountriesGetParams(packed middleware.Parameters) (params ContentV2DirectoryCountriesGetParams) {
	{
		key := middleware.ParameterKey{
			Name: "locale",
			In:   "query",
		}
		if v, ok := packed[key]; ok {
			params.Locale = v.(OptString)
		}
	}
	return params
}

func decodeContentV2DirectoryCountriesGetParams(args [0]string, argsEscaped bool, r *http.Request) (params ContentV2DirectoryCountriesGetParams, _ error) {
	q := uri.NewQueryDecoder(r.URL.Query())
	// Decode query: locale.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "locale",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				var paramsDotLocaleVal string
				if err := func() error {
					val, err := d.DecodeValue()
					if err != nil {
						return err
					}

					c, err := conv.ToString(val)
					if err != nil {
						return err
					}

					paramsDotLocaleVal = c
					return nil
				}(); err != nil {
					return err
				}
				params.Locale.SetTo(paramsDotLocaleVal)
				return nil
			}); err != nil {
				return err
			}
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "locale",
			In:   "query",
			Err:  err,
		}
	}
	return params, nil
}

// ContentV2DirectoryKindsGetParams is parameters of GET /content/v2/directory/kinds operation.
type ContentV2DirectoryKindsGetParams struct {
	// Язык полей ответа `subjectName` и `name`:
	// - `ru` — русский
	// - `en` — английский
	// - `zh` — китайский
	// Не используется в песочнице.
	Locale OptString
}

func unpackContentV2DirectoryKindsGetParams(packed middleware.Parameters) (params ContentV2DirectoryKindsGetParams) {
	{
		key := middleware.ParameterKey{
			Name: "locale",
			In:   "query",
		}
		if v, ok := packed[key]; ok {
			params.Locale = v.(OptString)
		}
	}
	return params
}

func decodeContentV2DirectoryKindsGetParams(args [0]string, argsEscaped bool, r *http.Request) (params ContentV2DirectoryKindsGetParams, _ error) {
	q := uri.NewQueryDecoder(r.URL.Query())
	// Decode query: locale.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "locale",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				var paramsDotLocaleVal string
				if err := func() error {
					val, err := d.DecodeValue()
					if err != nil {
						return err
					}

					c, err := conv.ToString(val)
					if err != nil {
						return err
					}

					paramsDotLocaleVal = c
					return nil
				}(); err != nil {
					return err
				}
				params.Locale.SetTo(paramsDotLocaleVal)
				return nil
			}); err != nil {
				return err
			}
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "locale",
			In:   "query",
			Err:  err,
		}
	}
	return params, nil
}

// ContentV2DirectorySeasonsGetParams is parameters of GET /content/v2/directory/seasons operation.
type ContentV2DirectorySeasonsGetParams struct {
	// Язык полей ответа `subjectName` и `name`:
	// - `ru` — русский
	// - `en` — английский
	// - `zh` — китайский
	// Не используется в песочнице.
	Locale OptString
}

func unpackContentV2DirectorySeasonsGetParams(packed middleware.Parameters) (params ContentV2DirectorySeasonsGetParams) {
	{
		key := middleware.ParameterKey{
			Name: "locale",
			In:   "query",
		}
		if v, ok := packed[key]; ok {
			params.Locale = v.(OptString)
		}
	}
	return params
}

func decodeContentV2DirectorySeasonsGetParams(args [0]string, argsEscaped bool, r *http.Request) (params ContentV2DirectorySeasonsGetParams, _ error) {
	q := uri.NewQueryDecoder(r.URL.Query())
	// Decode query: locale.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "locale",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				var paramsDotLocaleVal string
				if err := func() error {
					val, err := d.DecodeValue()
					if err != nil {
						return err
					}

					c, err := conv.ToString(val)
					if err != nil {
						return err
					}

					paramsDotLocaleVal = c
					return nil
				}(); err != nil {
					return err
				}
				params.Locale.SetTo(paramsDotLocaleVal)
				return nil
			}); err != nil {
				return err
			}
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "locale",
			In:   "query",
			Err:  err,
		}
	}
	return params, nil
}

// ContentV2DirectoryTnvedGetParams is parameters of GET /content/v2/directory/tnved operation.
type ContentV2DirectoryTnvedGetParams struct {
	// ID предмета.
	SubjectID int
	// Поиск по ТНВЭД-коду. Работает только в паре с `subjectID`.
	Search OptInt
	// Язык полей ответа:
	// - `ru` — русский
	// - `en` — английский
	// - `zh` — китайский
	// Не используется в песочнице.
	Locale OptString
}

func unpackContentV2DirectoryTnvedGetParams(packed middleware.Parameters) (params ContentV2DirectoryTnvedGetParams) {
	{
		key := middleware.ParameterKey{
			Name: "subjectID",
			In:   "query",
		}
		params.SubjectID = packed[key].(int)
	}
	{
		key := middleware.ParameterKey{
			Name: "search",
			In:   "query",
		}
		if v, ok := packed[key]; ok {
			params.Search = v.(OptInt)
		}
	}
	{
		key := middleware.ParameterKey{
			Name: "locale",
			In:   "query",
		}
		if v, ok := packed[key]; ok {
			params.Locale = v.(OptString)
		}
	}
	return params
}

func decodeContentV2DirectoryTnvedGetParams(args [0]string, argsEscaped bool, r *http.Request) (params ContentV2DirectoryTnvedGetParams, _ error) {
	q := uri.NewQueryDecoder(r.URL.Query())
	// Decode query: subjectID.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "subjectID",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				val, err := d.DecodeValue()
				if err != nil {
					return err
				}

				c, err := conv.ToInt(val)
				if err != nil {
					return err
				}

				params.SubjectID = c
				return nil
			}); err != nil {
				return err
			}
		} else {
			return err
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "subjectID",
			In:   "query",
			Err:  err,
		}
	}
	// Decode query: search.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "search",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				var paramsDotSearchVal int
				if err := func() error {
					val, err := d.DecodeValue()
					if err != nil {
						return err
					}

					c, err := conv.ToInt(val)
					if err != nil {
						return err
					}

					paramsDotSearchVal = c
					return nil
				}(); err != nil {
					return err
				}
				params.Search.SetTo(paramsDotSearchVal)
				return nil
			}); err != nil {
				return err
			}
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "search",
			In:   "query",
			Err:  err,
		}
	}
	// Decode query: locale.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "locale",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				var paramsDotLocaleVal string
				if err := func() error {
					val, err := d.DecodeValue()
					if err != nil {
						return err
					}

					c, err := conv.ToString(val)
					if err != nil {
						return err
					}

					paramsDotLocaleVal = c
					return nil
				}(); err != nil {
					return err
				}
				params.Locale.SetTo(paramsDotLocaleVal)
				return nil
			}); err != nil {
				return err
			}
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "locale",
			In:   "query",
			Err:  err,
		}
	}
	return params, nil
}

// ContentV2DirectoryVatGetParams is parameters of GET /content/v2/directory/vat operation.
type ContentV2DirectoryVatGetParams struct {
	// Язык полей ответа `subjectName` и `name`:
	// - `ru` — русский
	// - `en` — английский
	// - `zh` — китайский
	// Не используется в песочнице.
	Locale OptString
}

func unpackContentV2DirectoryVatGetParams(packed middleware.Parameters) (params ContentV2DirectoryVatGetParams) {
	{
		key := middleware.ParameterKey{
			Name: "locale",
			In:   "query",
		}
		if v, ok := packed[key]; ok {
			params.Locale = v.(OptString)
		}
	}
	return params
}

func decodeContentV2DirectoryVatGetParams(args [0]string, argsEscaped bool, r *http.Request) (params ContentV2DirectoryVatGetParams, _ error) {
	q := uri.NewQueryDecoder(r.URL.Query())
	// Decode query: locale.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "locale",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				var paramsDotLocaleVal string
				if err := func() error {
					val, err := d.DecodeValue()
					if err != nil {
						return err
					}

					c, err := conv.ToString(val)
					if err != nil {
						return err
					}

					paramsDotLocaleVal = c
					return nil
				}(); err != nil {
					return err
				}
				params.Locale.SetTo(paramsDotLocaleVal)
				return nil
			}); err != nil {
				return err
			}
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "locale",
			In:   "query",
			Err:  err,
		}
	}
	return params, nil
}

// ContentV2GetCardsListPostParams is parameters of POST /content/v2/get/cards/list operation.
type ContentV2GetCardsListPostParams struct {
	// Язык полей ответа `name`, `value` и `object`:
	// - `ru` — русский
	// - `en` — английский
	// - `zh` — китайский
	// Не используется в песочнице.
	Locale OptString
}

func unpackContentV2GetCardsListPostParams(packed middleware.Parameters) (params ContentV2GetCardsListPostParams) {
	{
		key := middleware.ParameterKey{
			Name: "locale",
			In:   "query",
		}
		if v, ok := packed[key]; ok {
			params.Locale = v.(OptString)
		}
	}
	return params
}

func decodeContentV2GetCardsListPostParams(args [0]string, argsEscaped bool, r *http.Request) (params ContentV2GetCardsListPostParams, _ error) {
	q := uri.NewQueryDecoder(r.URL.Query())
	// Decode query: locale.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "locale",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				var paramsDotLocaleVal string
				if err := func() error {
					val, err := d.DecodeValue()
					if err != nil {
						return err
					}

					c, err := conv.ToString(val)
					if err != nil {
						return err
					}

					paramsDotLocaleVal = c
					return nil
				}(); err != nil {
					return err
				}
				params.Locale.SetTo(paramsDotLocaleVal)
				return nil
			}); err != nil {
				return err
			}
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "locale",
			In:   "query",
			Err:  err,
		}
	}
	return params, nil
}

// ContentV2GetCardsTrashPostParams is parameters of POST /content/v2/get/cards/trash operation.
type ContentV2GetCardsTrashPostParams struct {
	// Язык полей ответа `name`, `value` и `object`: `ru`, `en`, `zh`.
	// Не используется в песочнице.
	Locale OptContentV2GetCardsTrashPostLocale
}

func unpackContentV2GetCardsTrashPostParams(packed middleware.Parameters) (params ContentV2GetCardsTrashPostParams) {
	{
		key := middleware.ParameterKey{
			Name: "locale",
			In:   "query",
		}
		if v, ok := packed[key]; ok {
			params.Locale = v.(OptContentV2GetCardsTrashPostLocale)
		}
	}
	return params
}

func decodeContentV2GetCardsTrashPostParams(args [0]string, argsEscaped bool, r *http.Request) (params ContentV2GetCardsTrashPostParams, _ error) {
	q := uri.NewQueryDecoder(r.URL.Query())
	// Decode query: locale.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "locale",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				var paramsDotLocaleVal ContentV2GetCardsTrashPostLocale
				if err := func() error {
					val, err := d.DecodeValue()
					if err != nil {
						return err
					}

					c, err := conv.ToString(val)
					if err != nil {
						return err
					}

					paramsDotLocaleVal = ContentV2GetCardsTrashPostLocale(c)
					return nil
				}(); err != nil {
					return err
				}
				params.Locale.SetTo(paramsDotLocaleVal)
				return nil
			}); err != nil {
				return err
			}
			if err := func() error {
				if value, ok := params.Locale.Get(); ok {
					if err := func() error {
						if err := value.Validate(); err != nil {
							return err
						}
						return nil
					}(); err != nil {
						return err
					}
				}
				return nil
			}(); err != nil {
				return err
			}
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "locale",
			In:   "query",
			Err:  err,
		}
	}
	return params, nil
}

// ContentV2ObjectAllGetParams is parameters of GET /content/v2/object/all operation.
type ContentV2ObjectAllGetParams struct {
	// Язык полей ответа:
	// - `ru` — русский
	// - `en` — английский
	// - `zh` — китайский
	// Не используется в песочнице.
	Locale OptString
	// Поиск по названию предмета (Носки), поиск работает по
	// подстроке, искать можно на любом из поддерживаемых
	// языков.
	Name   OptString
	Limit  OptInt
	Offset OptInt
	// ID родительской категории предмета.
	ParentID OptInt
}

func unpackContentV2ObjectAllGetParams(packed middleware.Parameters) (params ContentV2ObjectAllGetParams) {
	{
		key := middleware.ParameterKey{
			Name: "locale",
			In:   "query",
		}
		if v, ok := packed[key]; ok {
			params.Locale = v.(OptString)
		}
	}
	{
		key := middleware.ParameterKey{
			Name: "name",
			In:   "query",
		}
		if v, ok := packed[key]; ok {
			params.Name = v.(OptString)
		}
	}
	{
		key := middleware.ParameterKey{
			Name: "limit",
			In:   "query",
		}
		if v, ok := packed[key]; ok {
			params.Limit = v.(OptInt)
		}
	}
	{
		key := middleware.ParameterKey{
			Name: "offset",
			In:   "query",
		}
		if v, ok := packed[key]; ok {
			params.Offset = v.(OptInt)
		}
	}
	{
		key := middleware.ParameterKey{
			Name: "parentID",
			In:   "query",
		}
		if v, ok := packed[key]; ok {
			params.ParentID = v.(OptInt)
		}
	}
	return params
}

func decodeContentV2ObjectAllGetParams(args [0]string, argsEscaped bool, r *http.Request) (params ContentV2ObjectAllGetParams, _ error) {
	q := uri.NewQueryDecoder(r.URL.Query())
	// Decode query: locale.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "locale",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				var paramsDotLocaleVal string
				if err := func() error {
					val, err := d.DecodeValue()
					if err != nil {
						return err
					}

					c, err := conv.ToString(val)
					if err != nil {
						return err
					}

					paramsDotLocaleVal = c
					return nil
				}(); err != nil {
					return err
				}
				params.Locale.SetTo(paramsDotLocaleVal)
				return nil
			}); err != nil {
				return err
			}
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "locale",
			In:   "query",
			Err:  err,
		}
	}
	// Decode query: name.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "name",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				var paramsDotNameVal string
				if err := func() error {
					val, err := d.DecodeValue()
					if err != nil {
						return err
					}

					c, err := conv.ToString(val)
					if err != nil {
						return err
					}

					paramsDotNameVal = c
					return nil
				}(); err != nil {
					return err
				}
				params.Name.SetTo(paramsDotNameVal)
				return nil
			}); err != nil {
				return err
			}
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "name",
			In:   "query",
			Err:  err,
		}
	}
	// Set default value for query: limit.
	{
		val := int(30)
		params.Limit.SetTo(val)
	}
	// Decode query: limit.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "limit",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				var paramsDotLimitVal int
				if err := func() error {
					val, err := d.DecodeValue()
					if err != nil {
						return err
					}

					c, err := conv.ToInt(val)
					if err != nil {
						return err
					}

					paramsDotLimitVal = c
					return nil
				}(); err != nil {
					return err
				}
				params.Limit.SetTo(paramsDotLimitVal)
				return nil
			}); err != nil {
				return err
			}
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "limit",
			In:   "query",
			Err:  err,
		}
	}
	// Set default value for query: offset.
	{
		val := int(0)
		params.Offset.SetTo(val)
	}
	// Decode query: offset.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "offset",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				var paramsDotOffsetVal int
				if err := func() error {
					val, err := d.DecodeValue()
					if err != nil {
						return err
					}

					c, err := conv.ToInt(val)
					if err != nil {
						return err
					}

					paramsDotOffsetVal = c
					return nil
				}(); err != nil {
					return err
				}
				params.Offset.SetTo(paramsDotOffsetVal)
				return nil
			}); err != nil {
				return err
			}
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "offset",
			In:   "query",
			Err:  err,
		}
	}
	// Decode query: parentID.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "parentID",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				var paramsDotParentIDVal int
				if err := func() error {
					val, err := d.DecodeValue()
					if err != nil {
						return err
					}

					c, err := conv.ToInt(val)
					if err != nil {
						return err
					}

					paramsDotParentIDVal = c
					return nil
				}(); err != nil {
					return err
				}
				params.ParentID.SetTo(paramsDotParentIDVal)
				return nil
			}); err != nil {
				return err
			}
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "parentID",
			In:   "query",
			Err:  err,
		}
	}
	return params, nil
}

// ContentV2ObjectCharcsSubjectIdGetParams is parameters of GET /content/v2/object/charcs/{subjectId} operation.
type ContentV2ObjectCharcsSubjectIdGetParams struct {
	// ID предмета.
	SubjectId int
	// Язык полей ответа `subjectName` и `name`:
	// - `ru` — русский
	// - `en` — английский
	// - `zh` — китайский
	// Не используется в песочнице.
	Locale OptString
}

func unpackContentV2ObjectCharcsSubjectIdGetParams(packed middleware.Parameters) (params ContentV2ObjectCharcsSubjectIdGetParams) {
	{
		key := middleware.ParameterKey{
			Name: "subjectId",
			In:   "path",
		}
		params.SubjectId = packed[key].(int)
	}
	{
		key := middleware.ParameterKey{
			Name: "locale",
			In:   "query",
		}
		if v, ok := packed[key]; ok {
			params.Locale = v.(OptString)
		}
	}
	return params
}

func decodeContentV2ObjectCharcsSubjectIdGetParams(args [1]string, argsEscaped bool, r *http.Request) (params ContentV2ObjectCharcsSubjectIdGetParams, _ error) {
	q := uri.NewQueryDecoder(r.URL.Query())
	// Decode path: subjectId.
	if err := func() error {
		param := args[0]
		if argsEscaped {
			unescaped, err := url.PathUnescape(args[0])
			if err != nil {
				return errors.Wrap(err, "unescape path")
			}
			param = unescaped
		}
		if len(param) > 0 {
			d := uri.NewPathDecoder(uri.PathDecoderConfig{
				Param:   "subjectId",
				Value:   param,
				Style:   uri.PathStyleSimple,
				Explode: false,
			})

			if err := func() error {
				val, err := d.DecodeValue()
				if err != nil {
					return err
				}

				c, err := conv.ToInt(val)
				if err != nil {
					return err
				}

				params.SubjectId = c
				return nil
			}(); err != nil {
				return err
			}
		} else {
			return validate.ErrFieldRequired
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "subjectId",
			In:   "path",
			Err:  err,
		}
	}
	// Decode query: locale.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "locale",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				var paramsDotLocaleVal string
				if err := func() error {
					val, err := d.DecodeValue()
					if err != nil {
						return err
					}

					c, err := conv.ToString(val)
					if err != nil {
						return err
					}

					paramsDotLocaleVal = c
					return nil
				}(); err != nil {
					return err
				}
				params.Locale.SetTo(paramsDotLocaleVal)
				return nil
			}); err != nil {
				return err
			}
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "locale",
			In:   "query",
			Err:  err,
		}
	}
	return params, nil
}

// ContentV2ObjectParentAllGetParams is parameters of GET /content/v2/object/parent/all operation.
type ContentV2ObjectParentAllGetParams struct {
	// Язык поля ответа `name`:
	// - `ru` — русский
	// - `en` — английский
	// - `zh` — китайский
	// Не используется в песочнице.
	Locale OptString
}

func unpackContentV2ObjectParentAllGetParams(packed middleware.Parameters) (params ContentV2ObjectParentAllGetParams) {
	{
		key := middleware.ParameterKey{
			Name: "locale",
			In:   "query",
		}
		if v, ok := packed[key]; ok {
			params.Locale = v.(OptString)
		}
	}
	return params
}

func decodeContentV2ObjectParentAllGetParams(args [0]string, argsEscaped bool, r *http.Request) (params ContentV2ObjectParentAllGetParams, _ error) {
	q := uri.NewQueryDecoder(r.URL.Query())
	// Decode query: locale.
	if err := func() error {
		cfg := uri.QueryParameterDecodingConfig{
			Name:    "locale",
			Style:   uri.QueryStyleForm,
			Explode: true,
		}

		if err := q.HasParam(cfg); err == nil {
			if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
				var paramsDotLocaleVal string
				if err := func() error {
					val, err := d.DecodeValue()
					if err != nil {
						return err
					}

					c, err := conv.ToString(val)
					if err != nil {
						return err
					}

					paramsDotLocaleVal = c
					return nil
				}(); err != nil {
					return err
				}
				params.Locale.SetTo(paramsDotLocaleVal)
				return nil
			}); err != nil {
				return err
			}
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "locale",
			In:   "query",
			Err:  err,
		}
	}
	return params, nil
}

// ContentV3MediaFilePostParams is parameters of POST /content/v3/media/file operation.
type ContentV3MediaFilePostParams struct {
	// Артикул WB.
	XNmID string
	// Номер медиафайла на загрузку, начинается с `1`. При
	// загрузке видео всегда указывайте `1`.
	// Чтобы добавить изображение к уже загруженным, номер
	// медиафайла должен быть больше количества уже
	// загруженных медиафайлов.
	XPhotoNumber int
}

func unpackContentV3MediaFilePostParams(packed middleware.Parameters) (params ContentV3MediaFilePostParams) {
	{
		key := middleware.ParameterKey{
			Name: "X-Nm-Id",
			In:   "header",
		}
		params.XNmID = packed[key].(string)
	}
	{
		key := middleware.ParameterKey{
			Name: "X-Photo-Number",
			In:   "header",
		}
		params.XPhotoNumber = packed[key].(int)
	}
	return params
}

func decodeContentV3MediaFilePostParams(args [0]string, argsEscaped bool, r *http.Request) (params ContentV3MediaFilePostParams, _ error) {
	h := uri.NewHeaderDecoder(r.Header)
	// Decode header: X-Nm-Id.
	if err := func() error {
		cfg := uri.HeaderParameterDecodingConfig{
			Name:    "X-Nm-Id",
			Explode: false,
		}
		if err := h.HasParam(cfg); err == nil {
			if err := h.DecodeParam(cfg, func(d uri.Decoder) error {
				val, err := d.DecodeValue()
				if err != nil {
					return err
				}

				c, err := conv.ToString(val)
				if err != nil {
					return err
				}

				params.XNmID = c
				return nil
			}); err != nil {
				return err
			}
		} else {
			return err
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "X-Nm-Id",
			In:   "header",
			Err:  err,
		}
	}
	// Decode header: X-Photo-Number.
	if err := func() error {
		cfg := uri.HeaderParameterDecodingConfig{
			Name:    "X-Photo-Number",
			Explode: false,
		}
		if err := h.HasParam(cfg); err == nil {
			if err := h.DecodeParam(cfg, func(d uri.Decoder) error {
				val, err := d.DecodeValue()
				if err != nil {
					return err
				}

				c, err := conv.ToInt(val)
				if err != nil {
					return err
				}

				params.XPhotoNumber = c
				return nil
			}); err != nil {
				return err
			}
		} else {
			return err
		}
		return nil
	}(); err != nil {
		return params, &ogenerrors.DecodeParamError{
			Name: "X-Photo-Number",
			In:   "header",
			Err:  err,
		}
	}
	return params, nil
}
