// Code generated by github.com/ecordell/optgen. DO NOT EDIT.
package options

import (
	queryshape "github.com/authzed/spicedb/pkg/datastore/queryshape"
	defaults "github.com/creasty/defaults"
	helpers "github.com/ecordell/optgen/helpers"
	structpb "google.golang.org/protobuf/types/known/structpb"
)

type QueryOptionsOption func(q *QueryOptions)

// NewQueryOptionsWithOptions creates a new QueryOptions with the passed in options set
func NewQueryOptionsWithOptions(opts ...QueryOptionsOption) *QueryOptions {
	q := &QueryOptions{}
	for _, o := range opts {
		o(q)
	}
	return q
}

// NewQueryOptionsWithOptionsAndDefaults creates a new QueryOptions with the passed in options set starting from the defaults
func NewQueryOptionsWithOptionsAndDefaults(opts ...QueryOptionsOption) *QueryOptions {
	q := &QueryOptions{}
	defaults.MustSet(q)
	for _, o := range opts {
		o(q)
	}
	return q
}

// ToOption returns a new QueryOptionsOption that sets the values from the passed in QueryOptions
func (q *QueryOptions) ToOption() QueryOptionsOption {
	return func(to *QueryOptions) {
		to.Limit = q.Limit
		to.Sort = q.Sort
		to.After = q.After
		to.SkipCaveats = q.SkipCaveats
		to.SkipExpiration = q.SkipExpiration
		to.SQLCheckAssertionForTest = q.SQLCheckAssertionForTest
		to.SQLExplainCallbackForTest = q.SQLExplainCallbackForTest
		to.QueryShape = q.QueryShape
	}
}

// DebugMap returns a map form of QueryOptions for debugging
func (q QueryOptions) DebugMap() map[string]any {
	debugMap := map[string]any{}
	debugMap["Limit"] = helpers.DebugValue(q.Limit, false)
	debugMap["Sort"] = helpers.DebugValue(q.Sort, false)
	debugMap["After"] = helpers.DebugValue(q.After, false)
	debugMap["SkipCaveats"] = helpers.DebugValue(q.SkipCaveats, false)
	debugMap["SkipExpiration"] = helpers.DebugValue(q.SkipExpiration, false)
	debugMap["SQLCheckAssertionForTest"] = helpers.DebugValue(q.SQLCheckAssertionForTest, false)
	debugMap["SQLExplainCallbackForTest"] = helpers.DebugValue(q.SQLExplainCallbackForTest, false)
	debugMap["QueryShape"] = helpers.DebugValue(q.QueryShape, false)
	return debugMap
}

// QueryOptionsWithOptions configures an existing QueryOptions with the passed in options set
func QueryOptionsWithOptions(q *QueryOptions, opts ...QueryOptionsOption) *QueryOptions {
	for _, o := range opts {
		o(q)
	}
	return q
}

// WithOptions configures the receiver QueryOptions with the passed in options set
func (q *QueryOptions) WithOptions(opts ...QueryOptionsOption) *QueryOptions {
	for _, o := range opts {
		o(q)
	}
	return q
}

// WithLimit returns an option that can set Limit on a QueryOptions
func WithLimit(limit *uint64) QueryOptionsOption {
	return func(q *QueryOptions) {
		q.Limit = limit
	}
}

// WithSort returns an option that can set Sort on a QueryOptions
func WithSort(sort SortOrder) QueryOptionsOption {
	return func(q *QueryOptions) {
		q.Sort = sort
	}
}

// WithAfter returns an option that can set After on a QueryOptions
func WithAfter(after Cursor) QueryOptionsOption {
	return func(q *QueryOptions) {
		q.After = after
	}
}

// WithSkipCaveats returns an option that can set SkipCaveats on a QueryOptions
func WithSkipCaveats(skipCaveats bool) QueryOptionsOption {
	return func(q *QueryOptions) {
		q.SkipCaveats = skipCaveats
	}
}

// WithSkipExpiration returns an option that can set SkipExpiration on a QueryOptions
func WithSkipExpiration(skipExpiration bool) QueryOptionsOption {
	return func(q *QueryOptions) {
		q.SkipExpiration = skipExpiration
	}
}

// WithSQLCheckAssertionForTest returns an option that can set SQLCheckAssertionForTest on a QueryOptions
func WithSQLCheckAssertionForTest(sQLCheckAssertionForTest SQLCheckAssertionForTest) QueryOptionsOption {
	return func(q *QueryOptions) {
		q.SQLCheckAssertionForTest = sQLCheckAssertionForTest
	}
}

// WithSQLExplainCallbackForTest returns an option that can set SQLExplainCallbackForTest on a QueryOptions
func WithSQLExplainCallbackForTest(sQLExplainCallbackForTest SQLExplainCallbackForTest) QueryOptionsOption {
	return func(q *QueryOptions) {
		q.SQLExplainCallbackForTest = sQLExplainCallbackForTest
	}
}

// WithQueryShape returns an option that can set QueryShape on a QueryOptions
func WithQueryShape(queryShape queryshape.Shape) QueryOptionsOption {
	return func(q *QueryOptions) {
		q.QueryShape = queryShape
	}
}

type ReverseQueryOptionsOption func(r *ReverseQueryOptions)

// NewReverseQueryOptionsWithOptions creates a new ReverseQueryOptions with the passed in options set
func NewReverseQueryOptionsWithOptions(opts ...ReverseQueryOptionsOption) *ReverseQueryOptions {
	r := &ReverseQueryOptions{}
	for _, o := range opts {
		o(r)
	}
	return r
}

// NewReverseQueryOptionsWithOptionsAndDefaults creates a new ReverseQueryOptions with the passed in options set starting from the defaults
func NewReverseQueryOptionsWithOptionsAndDefaults(opts ...ReverseQueryOptionsOption) *ReverseQueryOptions {
	r := &ReverseQueryOptions{}
	defaults.MustSet(r)
	for _, o := range opts {
		o(r)
	}
	return r
}

// ToOption returns a new ReverseQueryOptionsOption that sets the values from the passed in ReverseQueryOptions
func (r *ReverseQueryOptions) ToOption() ReverseQueryOptionsOption {
	return func(to *ReverseQueryOptions) {
		to.ResRelation = r.ResRelation
		to.LimitForReverse = r.LimitForReverse
		to.SortForReverse = r.SortForReverse
		to.AfterForReverse = r.AfterForReverse
		to.SkipCaveatsForReverse = r.SkipCaveatsForReverse
		to.SkipExpirationForReverse = r.SkipExpirationForReverse
		to.SQLExplainCallbackForTestForReverse = r.SQLExplainCallbackForTestForReverse
		to.QueryShapeForReverse = r.QueryShapeForReverse
	}
}

// DebugMap returns a map form of ReverseQueryOptions for debugging
func (r ReverseQueryOptions) DebugMap() map[string]any {
	debugMap := map[string]any{}
	debugMap["ResRelation"] = helpers.DebugValue(r.ResRelation, false)
	debugMap["LimitForReverse"] = helpers.DebugValue(r.LimitForReverse, false)
	debugMap["SortForReverse"] = helpers.DebugValue(r.SortForReverse, false)
	debugMap["AfterForReverse"] = helpers.DebugValue(r.AfterForReverse, false)
	debugMap["SkipCaveatsForReverse"] = helpers.DebugValue(r.SkipCaveatsForReverse, false)
	debugMap["SkipExpirationForReverse"] = helpers.DebugValue(r.SkipExpirationForReverse, false)
	debugMap["SQLExplainCallbackForTestForReverse"] = helpers.DebugValue(r.SQLExplainCallbackForTestForReverse, false)
	debugMap["QueryShapeForReverse"] = helpers.DebugValue(r.QueryShapeForReverse, false)
	return debugMap
}

// ReverseQueryOptionsWithOptions configures an existing ReverseQueryOptions with the passed in options set
func ReverseQueryOptionsWithOptions(r *ReverseQueryOptions, opts ...ReverseQueryOptionsOption) *ReverseQueryOptions {
	for _, o := range opts {
		o(r)
	}
	return r
}

// WithOptions configures the receiver ReverseQueryOptions with the passed in options set
func (r *ReverseQueryOptions) WithOptions(opts ...ReverseQueryOptionsOption) *ReverseQueryOptions {
	for _, o := range opts {
		o(r)
	}
	return r
}

// WithResRelation returns an option that can set ResRelation on a ReverseQueryOptions
func WithResRelation(resRelation *ResourceRelation) ReverseQueryOptionsOption {
	return func(r *ReverseQueryOptions) {
		r.ResRelation = resRelation
	}
}

// WithLimitForReverse returns an option that can set LimitForReverse on a ReverseQueryOptions
func WithLimitForReverse(limitForReverse *uint64) ReverseQueryOptionsOption {
	return func(r *ReverseQueryOptions) {
		r.LimitForReverse = limitForReverse
	}
}

// WithSortForReverse returns an option that can set SortForReverse on a ReverseQueryOptions
func WithSortForReverse(sortForReverse SortOrder) ReverseQueryOptionsOption {
	return func(r *ReverseQueryOptions) {
		r.SortForReverse = sortForReverse
	}
}

// WithAfterForReverse returns an option that can set AfterForReverse on a ReverseQueryOptions
func WithAfterForReverse(afterForReverse Cursor) ReverseQueryOptionsOption {
	return func(r *ReverseQueryOptions) {
		r.AfterForReverse = afterForReverse
	}
}

// WithSkipCaveatsForReverse returns an option that can set SkipCaveatsForReverse on a ReverseQueryOptions
func WithSkipCaveatsForReverse(skipCaveatsForReverse bool) ReverseQueryOptionsOption {
	return func(r *ReverseQueryOptions) {
		r.SkipCaveatsForReverse = skipCaveatsForReverse
	}
}

// WithSkipExpirationForReverse returns an option that can set SkipExpirationForReverse on a ReverseQueryOptions
func WithSkipExpirationForReverse(skipExpirationForReverse bool) ReverseQueryOptionsOption {
	return func(r *ReverseQueryOptions) {
		r.SkipExpirationForReverse = skipExpirationForReverse
	}
}

// WithSQLExplainCallbackForTestForReverse returns an option that can set SQLExplainCallbackForTestForReverse on a ReverseQueryOptions
func WithSQLExplainCallbackForTestForReverse(sQLExplainCallbackForTestForReverse SQLExplainCallbackForTest) ReverseQueryOptionsOption {
	return func(r *ReverseQueryOptions) {
		r.SQLExplainCallbackForTestForReverse = sQLExplainCallbackForTestForReverse
	}
}

// WithQueryShapeForReverse returns an option that can set QueryShapeForReverse on a ReverseQueryOptions
func WithQueryShapeForReverse(queryShapeForReverse queryshape.Shape) ReverseQueryOptionsOption {
	return func(r *ReverseQueryOptions) {
		r.QueryShapeForReverse = queryShapeForReverse
	}
}

type RWTOptionsOption func(r *RWTOptions)

// NewRWTOptionsWithOptions creates a new RWTOptions with the passed in options set
func NewRWTOptionsWithOptions(opts ...RWTOptionsOption) *RWTOptions {
	r := &RWTOptions{}
	for _, o := range opts {
		o(r)
	}
	return r
}

// NewRWTOptionsWithOptionsAndDefaults creates a new RWTOptions with the passed in options set starting from the defaults
func NewRWTOptionsWithOptionsAndDefaults(opts ...RWTOptionsOption) *RWTOptions {
	r := &RWTOptions{}
	defaults.MustSet(r)
	for _, o := range opts {
		o(r)
	}
	return r
}

// ToOption returns a new RWTOptionsOption that sets the values from the passed in RWTOptions
func (r *RWTOptions) ToOption() RWTOptionsOption {
	return func(to *RWTOptions) {
		to.DisableRetries = r.DisableRetries
		to.Metadata = r.Metadata
	}
}

// DebugMap returns a map form of RWTOptions for debugging
func (r RWTOptions) DebugMap() map[string]any {
	debugMap := map[string]any{}
	debugMap["DisableRetries"] = helpers.DebugValue(r.DisableRetries, false)
	debugMap["Metadata"] = helpers.DebugValue(r.Metadata, false)
	return debugMap
}

// RWTOptionsWithOptions configures an existing RWTOptions with the passed in options set
func RWTOptionsWithOptions(r *RWTOptions, opts ...RWTOptionsOption) *RWTOptions {
	for _, o := range opts {
		o(r)
	}
	return r
}

// WithOptions configures the receiver RWTOptions with the passed in options set
func (r *RWTOptions) WithOptions(opts ...RWTOptionsOption) *RWTOptions {
	for _, o := range opts {
		o(r)
	}
	return r
}

// WithDisableRetries returns an option that can set DisableRetries on a RWTOptions
func WithDisableRetries(disableRetries bool) RWTOptionsOption {
	return func(r *RWTOptions) {
		r.DisableRetries = disableRetries
	}
}

// WithMetadata returns an option that can set Metadata on a RWTOptions
func WithMetadata(metadata *structpb.Struct) RWTOptionsOption {
	return func(r *RWTOptions) {
		r.Metadata = metadata
	}
}
