// Code generated by BobGen psql v0.42.5. DO NOT EDIT.
// This file is meant to be re-generated in place and/or deleted at any time.

package factory

import (
	"context"
	"encoding/json"
	"testing"
	"time"

	"github.com/Gleipnir-Technology/bob"
	"github.com/Gleipnir-Technology/bob/types"
	models "github.com/Gleipnir-Technology/nidus-sync/db/models"
	"github.com/aarondl/opt/null"
	"github.com/aarondl/opt/omit"
	"github.com/aarondl/opt/omitnull"
	"github.com/google/uuid"
	"github.com/jaswdr/faker/v2"
)

type FieldseekerPooldetailMod interface {
	Apply(context.Context, *FieldseekerPooldetailTemplate)
}

type FieldseekerPooldetailModFunc func(context.Context, *FieldseekerPooldetailTemplate)

func (f FieldseekerPooldetailModFunc) Apply(ctx context.Context, n *FieldseekerPooldetailTemplate) {
	f(ctx, n)
}

type FieldseekerPooldetailModSlice []FieldseekerPooldetailMod

func (mods FieldseekerPooldetailModSlice) Apply(ctx context.Context, n *FieldseekerPooldetailTemplate) {
	for _, f := range mods {
		f.Apply(ctx, n)
	}
}

// FieldseekerPooldetailTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FieldseekerPooldetailTemplate struct {
	Objectid       func() int64
	TrapdataID     func() null.Val[uuid.UUID]
	PoolID         func() null.Val[uuid.UUID]
	Species        func() null.Val[string]
	Females        func() null.Val[int16]
	Globalid       func() uuid.UUID
	CreatedUser    func() null.Val[string]
	CreatedDate    func() null.Val[time.Time]
	LastEditedUser func() null.Val[string]
	LastEditedDate func() null.Val[time.Time]
	Creationdate   func() null.Val[time.Time]
	Creator        func() null.Val[string]
	Editdate       func() null.Val[time.Time]
	Editor         func() null.Val[string]
	Geometry       func() types.JSON[json.RawMessage]
	Geospatial     func() null.Val[string]
	Version        func() int32
	OrganizationID func() int32

	r fieldseekerPooldetailR
	f *Factory

	alreadyPersisted bool
}

type fieldseekerPooldetailR struct {
	Organization *fieldseekerPooldetailROrganizationR
}

type fieldseekerPooldetailROrganizationR struct {
	o *OrganizationTemplate
}

// Apply mods to the FieldseekerPooldetailTemplate
func (o *FieldseekerPooldetailTemplate) Apply(ctx context.Context, mods ...FieldseekerPooldetailMod) {
	for _, mod := range mods {
		mod.Apply(ctx, o)
	}
}

// setModelRels creates and sets the relationships on *models.FieldseekerPooldetail
// according to the relationships in the template. Nothing is inserted into the db
func (t FieldseekerPooldetailTemplate) setModelRels(o *models.FieldseekerPooldetail) {
	if t.r.Organization != nil {
		rel := t.r.Organization.o.Build()
		rel.R.Pooldetails = append(rel.R.Pooldetails, o)
		o.OrganizationID = rel.ID // h2
		o.R.Organization = rel
	}
}

// BuildSetter returns an *models.FieldseekerPooldetailSetter
// this does nothing with the relationship templates
func (o FieldseekerPooldetailTemplate) BuildSetter() *models.FieldseekerPooldetailSetter {
	m := &models.FieldseekerPooldetailSetter{}

	if o.Objectid != nil {
		val := o.Objectid()
		m.Objectid = omit.From(val)
	}
	if o.TrapdataID != nil {
		val := o.TrapdataID()
		m.TrapdataID = omitnull.FromNull(val)
	}
	if o.PoolID != nil {
		val := o.PoolID()
		m.PoolID = omitnull.FromNull(val)
	}
	if o.Species != nil {
		val := o.Species()
		m.Species = omitnull.FromNull(val)
	}
	if o.Females != nil {
		val := o.Females()
		m.Females = omitnull.FromNull(val)
	}
	if o.Globalid != nil {
		val := o.Globalid()
		m.Globalid = omit.From(val)
	}
	if o.CreatedUser != nil {
		val := o.CreatedUser()
		m.CreatedUser = omitnull.FromNull(val)
	}
	if o.CreatedDate != nil {
		val := o.CreatedDate()
		m.CreatedDate = omitnull.FromNull(val)
	}
	if o.LastEditedUser != nil {
		val := o.LastEditedUser()
		m.LastEditedUser = omitnull.FromNull(val)
	}
	if o.LastEditedDate != nil {
		val := o.LastEditedDate()
		m.LastEditedDate = omitnull.FromNull(val)
	}
	if o.Creationdate != nil {
		val := o.Creationdate()
		m.Creationdate = omitnull.FromNull(val)
	}
	if o.Creator != nil {
		val := o.Creator()
		m.Creator = omitnull.FromNull(val)
	}
	if o.Editdate != nil {
		val := o.Editdate()
		m.Editdate = omitnull.FromNull(val)
	}
	if o.Editor != nil {
		val := o.Editor()
		m.Editor = omitnull.FromNull(val)
	}
	if o.Geometry != nil {
		val := o.Geometry()
		m.Geometry = omit.From(val)
	}
	if o.Geospatial != nil {
		val := o.Geospatial()
		m.Geospatial = omitnull.FromNull(val)
	}
	if o.Version != nil {
		val := o.Version()
		m.Version = omit.From(val)
	}
	if o.OrganizationID != nil {
		val := o.OrganizationID()
		m.OrganizationID = omit.From(val)
	}

	return m
}

// BuildManySetter returns an []*models.FieldseekerPooldetailSetter
// this does nothing with the relationship templates
func (o FieldseekerPooldetailTemplate) BuildManySetter(number int) []*models.FieldseekerPooldetailSetter {
	m := make([]*models.FieldseekerPooldetailSetter, number)

	for i := range m {
		m[i] = o.BuildSetter()
	}

	return m
}

// Build returns an *models.FieldseekerPooldetail
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use FieldseekerPooldetailTemplate.Create
func (o FieldseekerPooldetailTemplate) Build() *models.FieldseekerPooldetail {
	m := &models.FieldseekerPooldetail{}

	if o.Objectid != nil {
		m.Objectid = o.Objectid()
	}
	if o.TrapdataID != nil {
		m.TrapdataID = o.TrapdataID()
	}
	if o.PoolID != nil {
		m.PoolID = o.PoolID()
	}
	if o.Species != nil {
		m.Species = o.Species()
	}
	if o.Females != nil {
		m.Females = o.Females()
	}
	if o.Globalid != nil {
		m.Globalid = o.Globalid()
	}
	if o.CreatedUser != nil {
		m.CreatedUser = o.CreatedUser()
	}
	if o.CreatedDate != nil {
		m.CreatedDate = o.CreatedDate()
	}
	if o.LastEditedUser != nil {
		m.LastEditedUser = o.LastEditedUser()
	}
	if o.LastEditedDate != nil {
		m.LastEditedDate = o.LastEditedDate()
	}
	if o.Creationdate != nil {
		m.Creationdate = o.Creationdate()
	}
	if o.Creator != nil {
		m.Creator = o.Creator()
	}
	if o.Editdate != nil {
		m.Editdate = o.Editdate()
	}
	if o.Editor != nil {
		m.Editor = o.Editor()
	}
	if o.Geometry != nil {
		m.Geometry = o.Geometry()
	}
	if o.Geospatial != nil {
		m.Geospatial = o.Geospatial()
	}
	if o.Version != nil {
		m.Version = o.Version()
	}
	if o.OrganizationID != nil {
		m.OrganizationID = o.OrganizationID()
	}

	o.setModelRels(m)

	return m
}

// BuildMany returns an models.FieldseekerPooldetailSlice
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use FieldseekerPooldetailTemplate.CreateMany
func (o FieldseekerPooldetailTemplate) BuildMany(number int) models.FieldseekerPooldetailSlice {
	m := make(models.FieldseekerPooldetailSlice, number)

	for i := range m {
		m[i] = o.Build()
	}

	return m
}

func ensureCreatableFieldseekerPooldetail(m *models.FieldseekerPooldetailSetter) {
	if !(m.Objectid.IsValue()) {
		val := random_int64(nil)
		m.Objectid = omit.From(val)
	}
	if !(m.Globalid.IsValue()) {
		val := random_uuid_UUID(nil)
		m.Globalid = omit.From(val)
	}
	if !(m.Geometry.IsValue()) {
		val := random_types_JSON_json_RawMessage_(nil)
		m.Geometry = omit.From(val)
	}
	if !(m.OrganizationID.IsValue()) {
		val := random_int32(nil)
		m.OrganizationID = omit.From(val)
	}
}

// insertOptRels creates and inserts any optional the relationships on *models.FieldseekerPooldetail
// according to the relationships in the template.
// any required relationship should have already exist on the model
func (o *FieldseekerPooldetailTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerPooldetail) error {
	var err error

	return err
}

// Create builds a fieldseekerPooldetail and inserts it into the database
// Relations objects are also inserted and placed in the .R field
func (o *FieldseekerPooldetailTemplate) Create(ctx context.Context, exec bob.Executor) (*models.FieldseekerPooldetail, error) {
	var err error
	opt := o.BuildSetter()
	ensureCreatableFieldseekerPooldetail(opt)

	if o.r.Organization == nil {
		FieldseekerPooldetailMods.WithNewOrganization().Apply(ctx, o)
	}

	var rel0 *models.Organization

	if o.r.Organization.o.alreadyPersisted {
		rel0 = o.r.Organization.o.Build()
	} else {
		rel0, err = o.r.Organization.o.Create(ctx, exec)
		if err != nil {
			return nil, err
		}
	}

	opt.OrganizationID = omit.From(rel0.ID)

	m, err := models.FieldseekerPooldetails.Insert(opt).One(ctx, exec)
	if err != nil {
		return nil, err
	}

	m.R.Organization = rel0

	if err := o.insertOptRels(ctx, exec, m); err != nil {
		return nil, err
	}
	return m, err
}

// MustCreate builds a fieldseekerPooldetail and inserts it into the database
// Relations objects are also inserted and placed in the .R field
// panics if an error occurs
func (o *FieldseekerPooldetailTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerPooldetail {
	m, err := o.Create(ctx, exec)
	if err != nil {
		panic(err)
	}
	return m
}

// CreateOrFail builds a fieldseekerPooldetail and inserts it into the database
// Relations objects are also inserted and placed in the .R field
// It calls `tb.Fatal(err)` on the test/benchmark if an error occurs
func (o *FieldseekerPooldetailTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerPooldetail {
	tb.Helper()
	m, err := o.Create(ctx, exec)
	if err != nil {
		tb.Fatal(err)
		return nil
	}
	return m
}

// CreateMany builds multiple fieldseekerPooldetails and inserts them into the database
// Relations objects are also inserted and placed in the .R field
func (o FieldseekerPooldetailTemplate) CreateMany(ctx context.Context, exec bob.Executor, number int) (models.FieldseekerPooldetailSlice, error) {
	var err error
	m := make(models.FieldseekerPooldetailSlice, number)

	for i := range m {
		m[i], err = o.Create(ctx, exec)
		if err != nil {
			return nil, err
		}
	}

	return m, nil
}

// MustCreateMany builds multiple fieldseekerPooldetails and inserts them into the database
// Relations objects are also inserted and placed in the .R field
// panics if an error occurs
func (o FieldseekerPooldetailTemplate) MustCreateMany(ctx context.Context, exec bob.Executor, number int) models.FieldseekerPooldetailSlice {
	m, err := o.CreateMany(ctx, exec, number)
	if err != nil {
		panic(err)
	}
	return m
}

// CreateManyOrFail builds multiple fieldseekerPooldetails and inserts them into the database
// Relations objects are also inserted and placed in the .R field
// It calls `tb.Fatal(err)` on the test/benchmark if an error occurs
func (o FieldseekerPooldetailTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerPooldetailSlice {
	tb.Helper()
	m, err := o.CreateMany(ctx, exec, number)
	if err != nil {
		tb.Fatal(err)
		return nil
	}
	return m
}

// FieldseekerPooldetail has methods that act as mods for the FieldseekerPooldetailTemplate
var FieldseekerPooldetailMods fieldseekerPooldetailMods

type fieldseekerPooldetailMods struct{}

func (m fieldseekerPooldetailMods) RandomizeAllColumns(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModSlice{
		FieldseekerPooldetailMods.RandomObjectid(f),
		FieldseekerPooldetailMods.RandomTrapdataID(f),
		FieldseekerPooldetailMods.RandomPoolID(f),
		FieldseekerPooldetailMods.RandomSpecies(f),
		FieldseekerPooldetailMods.RandomFemales(f),
		FieldseekerPooldetailMods.RandomGlobalid(f),
		FieldseekerPooldetailMods.RandomCreatedUser(f),
		FieldseekerPooldetailMods.RandomCreatedDate(f),
		FieldseekerPooldetailMods.RandomLastEditedUser(f),
		FieldseekerPooldetailMods.RandomLastEditedDate(f),
		FieldseekerPooldetailMods.RandomCreationdate(f),
		FieldseekerPooldetailMods.RandomCreator(f),
		FieldseekerPooldetailMods.RandomEditdate(f),
		FieldseekerPooldetailMods.RandomEditor(f),
		FieldseekerPooldetailMods.RandomGeometry(f),
		FieldseekerPooldetailMods.RandomGeospatial(f),
		FieldseekerPooldetailMods.RandomVersion(f),
		FieldseekerPooldetailMods.RandomOrganizationID(f),
	}
}

// Set the model columns to this value
func (m fieldseekerPooldetailMods) Objectid(val int64) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Objectid = func() int64 { return val }
	})
}

// Set the Column from the function
func (m fieldseekerPooldetailMods) ObjectidFunc(f func() int64) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Objectid = f
	})
}

// Clear any values for the column
func (m fieldseekerPooldetailMods) UnsetObjectid() FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Objectid = nil
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m fieldseekerPooldetailMods) RandomObjectid(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Objectid = func() int64 {
			return random_int64(f)
		}
	})
}

// Set the model columns to this value
func (m fieldseekerPooldetailMods) TrapdataID(val null.Val[uuid.UUID]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.TrapdataID = func() null.Val[uuid.UUID] { return val }
	})
}

// Set the Column from the function
func (m fieldseekerPooldetailMods) TrapdataIDFunc(f func() null.Val[uuid.UUID]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.TrapdataID = f
	})
}

// Clear any values for the column
func (m fieldseekerPooldetailMods) UnsetTrapdataID() FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.TrapdataID = nil
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fieldseekerPooldetailMods) RandomTrapdataID(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.TrapdataID = func() null.Val[uuid.UUID] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_uuid_UUID(f)
			return null.From(val)
		}
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fieldseekerPooldetailMods) RandomTrapdataIDNotNull(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.TrapdataID = func() null.Val[uuid.UUID] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_uuid_UUID(f)
			return null.From(val)
		}
	})
}

// Set the model columns to this value
func (m fieldseekerPooldetailMods) PoolID(val null.Val[uuid.UUID]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.PoolID = func() null.Val[uuid.UUID] { return val }
	})
}

// Set the Column from the function
func (m fieldseekerPooldetailMods) PoolIDFunc(f func() null.Val[uuid.UUID]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.PoolID = f
	})
}

// Clear any values for the column
func (m fieldseekerPooldetailMods) UnsetPoolID() FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.PoolID = nil
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fieldseekerPooldetailMods) RandomPoolID(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.PoolID = func() null.Val[uuid.UUID] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_uuid_UUID(f)
			return null.From(val)
		}
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fieldseekerPooldetailMods) RandomPoolIDNotNull(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.PoolID = func() null.Val[uuid.UUID] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_uuid_UUID(f)
			return null.From(val)
		}
	})
}

// Set the model columns to this value
func (m fieldseekerPooldetailMods) Species(val null.Val[string]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Species = func() null.Val[string] { return val }
	})
}

// Set the Column from the function
func (m fieldseekerPooldetailMods) SpeciesFunc(f func() null.Val[string]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Species = f
	})
}

// Clear any values for the column
func (m fieldseekerPooldetailMods) UnsetSpecies() FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Species = nil
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fieldseekerPooldetailMods) RandomSpecies(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Species = func() null.Val[string] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_string(f, "50")
			return null.From(val)
		}
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fieldseekerPooldetailMods) RandomSpeciesNotNull(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Species = func() null.Val[string] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_string(f, "50")
			return null.From(val)
		}
	})
}

// Set the model columns to this value
func (m fieldseekerPooldetailMods) Females(val null.Val[int16]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Females = func() null.Val[int16] { return val }
	})
}

// Set the Column from the function
func (m fieldseekerPooldetailMods) FemalesFunc(f func() null.Val[int16]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Females = f
	})
}

// Clear any values for the column
func (m fieldseekerPooldetailMods) UnsetFemales() FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Females = nil
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fieldseekerPooldetailMods) RandomFemales(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Females = func() null.Val[int16] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_int16(f)
			return null.From(val)
		}
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fieldseekerPooldetailMods) RandomFemalesNotNull(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Females = func() null.Val[int16] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_int16(f)
			return null.From(val)
		}
	})
}

// Set the model columns to this value
func (m fieldseekerPooldetailMods) Globalid(val uuid.UUID) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Globalid = func() uuid.UUID { return val }
	})
}

// Set the Column from the function
func (m fieldseekerPooldetailMods) GlobalidFunc(f func() uuid.UUID) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Globalid = f
	})
}

// Clear any values for the column
func (m fieldseekerPooldetailMods) UnsetGlobalid() FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Globalid = nil
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m fieldseekerPooldetailMods) RandomGlobalid(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Globalid = func() uuid.UUID {
			return random_uuid_UUID(f)
		}
	})
}

// Set the model columns to this value
func (m fieldseekerPooldetailMods) CreatedUser(val null.Val[string]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.CreatedUser = func() null.Val[string] { return val }
	})
}

// Set the Column from the function
func (m fieldseekerPooldetailMods) CreatedUserFunc(f func() null.Val[string]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.CreatedUser = f
	})
}

// Clear any values for the column
func (m fieldseekerPooldetailMods) UnsetCreatedUser() FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.CreatedUser = nil
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fieldseekerPooldetailMods) RandomCreatedUser(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.CreatedUser = func() null.Val[string] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_string(f, "255")
			return null.From(val)
		}
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fieldseekerPooldetailMods) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.CreatedUser = func() null.Val[string] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_string(f, "255")
			return null.From(val)
		}
	})
}

// Set the model columns to this value
func (m fieldseekerPooldetailMods) CreatedDate(val null.Val[time.Time]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.CreatedDate = func() null.Val[time.Time] { return val }
	})
}

// Set the Column from the function
func (m fieldseekerPooldetailMods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.CreatedDate = f
	})
}

// Clear any values for the column
func (m fieldseekerPooldetailMods) UnsetCreatedDate() FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.CreatedDate = nil
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fieldseekerPooldetailMods) RandomCreatedDate(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.CreatedDate = func() null.Val[time.Time] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_time_Time(f)
			return null.From(val)
		}
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fieldseekerPooldetailMods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.CreatedDate = func() null.Val[time.Time] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_time_Time(f)
			return null.From(val)
		}
	})
}

// Set the model columns to this value
func (m fieldseekerPooldetailMods) LastEditedUser(val null.Val[string]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.LastEditedUser = func() null.Val[string] { return val }
	})
}

// Set the Column from the function
func (m fieldseekerPooldetailMods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.LastEditedUser = f
	})
}

// Clear any values for the column
func (m fieldseekerPooldetailMods) UnsetLastEditedUser() FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.LastEditedUser = nil
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fieldseekerPooldetailMods) RandomLastEditedUser(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.LastEditedUser = func() null.Val[string] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_string(f, "255")
			return null.From(val)
		}
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fieldseekerPooldetailMods) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.LastEditedUser = func() null.Val[string] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_string(f, "255")
			return null.From(val)
		}
	})
}

// Set the model columns to this value
func (m fieldseekerPooldetailMods) LastEditedDate(val null.Val[time.Time]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.LastEditedDate = func() null.Val[time.Time] { return val }
	})
}

// Set the Column from the function
func (m fieldseekerPooldetailMods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.LastEditedDate = f
	})
}

// Clear any values for the column
func (m fieldseekerPooldetailMods) UnsetLastEditedDate() FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.LastEditedDate = nil
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fieldseekerPooldetailMods) RandomLastEditedDate(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.LastEditedDate = func() null.Val[time.Time] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_time_Time(f)
			return null.From(val)
		}
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fieldseekerPooldetailMods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.LastEditedDate = func() null.Val[time.Time] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_time_Time(f)
			return null.From(val)
		}
	})
}

// Set the model columns to this value
func (m fieldseekerPooldetailMods) Creationdate(val null.Val[time.Time]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Creationdate = func() null.Val[time.Time] { return val }
	})
}

// Set the Column from the function
func (m fieldseekerPooldetailMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Creationdate = f
	})
}

// Clear any values for the column
func (m fieldseekerPooldetailMods) UnsetCreationdate() FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Creationdate = nil
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fieldseekerPooldetailMods) RandomCreationdate(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Creationdate = func() null.Val[time.Time] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_time_Time(f)
			return null.From(val)
		}
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fieldseekerPooldetailMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Creationdate = func() null.Val[time.Time] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_time_Time(f)
			return null.From(val)
		}
	})
}

// Set the model columns to this value
func (m fieldseekerPooldetailMods) Creator(val null.Val[string]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Creator = func() null.Val[string] { return val }
	})
}

// Set the Column from the function
func (m fieldseekerPooldetailMods) CreatorFunc(f func() null.Val[string]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Creator = f
	})
}

// Clear any values for the column
func (m fieldseekerPooldetailMods) UnsetCreator() FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Creator = nil
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fieldseekerPooldetailMods) RandomCreator(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Creator = func() null.Val[string] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_string(f, "128")
			return null.From(val)
		}
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fieldseekerPooldetailMods) RandomCreatorNotNull(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Creator = func() null.Val[string] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_string(f, "128")
			return null.From(val)
		}
	})
}

// Set the model columns to this value
func (m fieldseekerPooldetailMods) Editdate(val null.Val[time.Time]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Editdate = func() null.Val[time.Time] { return val }
	})
}

// Set the Column from the function
func (m fieldseekerPooldetailMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Editdate = f
	})
}

// Clear any values for the column
func (m fieldseekerPooldetailMods) UnsetEditdate() FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Editdate = nil
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fieldseekerPooldetailMods) RandomEditdate(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Editdate = func() null.Val[time.Time] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_time_Time(f)
			return null.From(val)
		}
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fieldseekerPooldetailMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Editdate = func() null.Val[time.Time] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_time_Time(f)
			return null.From(val)
		}
	})
}

// Set the model columns to this value
func (m fieldseekerPooldetailMods) Editor(val null.Val[string]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Editor = func() null.Val[string] { return val }
	})
}

// Set the Column from the function
func (m fieldseekerPooldetailMods) EditorFunc(f func() null.Val[string]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Editor = f
	})
}

// Clear any values for the column
func (m fieldseekerPooldetailMods) UnsetEditor() FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Editor = nil
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fieldseekerPooldetailMods) RandomEditor(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Editor = func() null.Val[string] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_string(f, "128")
			return null.From(val)
		}
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fieldseekerPooldetailMods) RandomEditorNotNull(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Editor = func() null.Val[string] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_string(f, "128")
			return null.From(val)
		}
	})
}

// Set the model columns to this value
func (m fieldseekerPooldetailMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Geometry = func() types.JSON[json.RawMessage] { return val }
	})
}

// Set the Column from the function
func (m fieldseekerPooldetailMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Geometry = f
	})
}

// Clear any values for the column
func (m fieldseekerPooldetailMods) UnsetGeometry() FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Geometry = nil
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m fieldseekerPooldetailMods) RandomGeometry(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Geometry = func() types.JSON[json.RawMessage] {
			return random_types_JSON_json_RawMessage_(f)
		}
	})
}

// Set the model columns to this value
func (m fieldseekerPooldetailMods) Geospatial(val null.Val[string]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Geospatial = func() null.Val[string] { return val }
	})
}

// Set the Column from the function
func (m fieldseekerPooldetailMods) GeospatialFunc(f func() null.Val[string]) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Geospatial = f
	})
}

// Clear any values for the column
func (m fieldseekerPooldetailMods) UnsetGeospatial() FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Geospatial = nil
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is sometimes null
func (m fieldseekerPooldetailMods) RandomGeospatial(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Geospatial = func() null.Val[string] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_string(f)
			return null.From(val)
		}
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
// The generated value is never null
func (m fieldseekerPooldetailMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Geospatial = func() null.Val[string] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_string(f)
			return null.From(val)
		}
	})
}

// Set the model columns to this value
func (m fieldseekerPooldetailMods) Version(val int32) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Version = func() int32 { return val }
	})
}

// Set the Column from the function
func (m fieldseekerPooldetailMods) VersionFunc(f func() int32) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Version = f
	})
}

// Clear any values for the column
func (m fieldseekerPooldetailMods) UnsetVersion() FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Version = nil
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m fieldseekerPooldetailMods) RandomVersion(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.Version = func() int32 {
			return random_int32(f)
		}
	})
}

// Set the model columns to this value
func (m fieldseekerPooldetailMods) OrganizationID(val int32) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.OrganizationID = func() int32 { return val }
	})
}

// Set the Column from the function
func (m fieldseekerPooldetailMods) OrganizationIDFunc(f func() int32) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.OrganizationID = f
	})
}

// Clear any values for the column
func (m fieldseekerPooldetailMods) UnsetOrganizationID() FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.OrganizationID = nil
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m fieldseekerPooldetailMods) RandomOrganizationID(f *faker.Faker) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(_ context.Context, o *FieldseekerPooldetailTemplate) {
		o.OrganizationID = func() int32 {
			return random_int32(f)
		}
	})
}

func (m fieldseekerPooldetailMods) WithParentsCascading() FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(ctx context.Context, o *FieldseekerPooldetailTemplate) {
		if isDone, _ := fieldseekerPooldetailWithParentsCascadingCtx.Value(ctx); isDone {
			return
		}
		ctx = fieldseekerPooldetailWithParentsCascadingCtx.WithValue(ctx, true)
		{

			related := o.f.NewOrganizationWithContext(ctx, OrganizationMods.WithParentsCascading())
			m.WithOrganization(related).Apply(ctx, o)
		}
	})
}

func (m fieldseekerPooldetailMods) WithOrganization(rel *OrganizationTemplate) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(ctx context.Context, o *FieldseekerPooldetailTemplate) {
		o.r.Organization = &fieldseekerPooldetailROrganizationR{
			o: rel,
		}
	})
}

func (m fieldseekerPooldetailMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(ctx context.Context, o *FieldseekerPooldetailTemplate) {
		related := o.f.NewOrganizationWithContext(ctx, mods...)

		m.WithOrganization(related).Apply(ctx, o)
	})
}

func (m fieldseekerPooldetailMods) WithExistingOrganization(em *models.Organization) FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(ctx context.Context, o *FieldseekerPooldetailTemplate) {
		o.r.Organization = &fieldseekerPooldetailROrganizationR{
			o: o.f.FromExistingOrganization(em),
		}
	})
}

func (m fieldseekerPooldetailMods) WithoutOrganization() FieldseekerPooldetailMod {
	return FieldseekerPooldetailModFunc(func(ctx context.Context, o *FieldseekerPooldetailTemplate) {
		o.r.Organization = nil
	})
}
