// 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 FieldseekerFieldscoutinglogMod interface {
	Apply(context.Context, *FieldseekerFieldscoutinglogTemplate)
}

type FieldseekerFieldscoutinglogModFunc func(context.Context, *FieldseekerFieldscoutinglogTemplate)

func (f FieldseekerFieldscoutinglogModFunc) Apply(ctx context.Context, n *FieldseekerFieldscoutinglogTemplate) {
	f(ctx, n)
}

type FieldseekerFieldscoutinglogModSlice []FieldseekerFieldscoutinglogMod

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

// FieldseekerFieldscoutinglogTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FieldseekerFieldscoutinglogTemplate struct {
	Objectid       func() int64
	Status         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 fieldseekerFieldscoutinglogR
	f *Factory

	alreadyPersisted bool
}

type fieldseekerFieldscoutinglogR struct {
	Organization *fieldseekerFieldscoutinglogROrganizationR
}

type fieldseekerFieldscoutinglogROrganizationR struct {
	o *OrganizationTemplate
}

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

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

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

	if o.Objectid != nil {
		val := o.Objectid()
		m.Objectid = omit.From(val)
	}
	if o.Status != nil {
		val := o.Status()
		m.Status = 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.FieldseekerFieldscoutinglogSetter
// this does nothing with the relationship templates
func (o FieldseekerFieldscoutinglogTemplate) BuildManySetter(number int) []*models.FieldseekerFieldscoutinglogSetter {
	m := make([]*models.FieldseekerFieldscoutinglogSetter, number)

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

	return m
}

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

	if o.Objectid != nil {
		m.Objectid = o.Objectid()
	}
	if o.Status != nil {
		m.Status = o.Status()
	}
	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.FieldseekerFieldscoutinglogSlice
// Related objects are also created and placed in the .R field
// NOTE: Objects are not inserted into the database. Use FieldseekerFieldscoutinglogTemplate.CreateMany
func (o FieldseekerFieldscoutinglogTemplate) BuildMany(number int) models.FieldseekerFieldscoutinglogSlice {
	m := make(models.FieldseekerFieldscoutinglogSlice, number)

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

	return m
}

func ensureCreatableFieldseekerFieldscoutinglog(m *models.FieldseekerFieldscoutinglogSetter) {
	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.FieldseekerFieldscoutinglog
// according to the relationships in the template.
// any required relationship should have already exist on the model
func (o *FieldseekerFieldscoutinglogTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FieldseekerFieldscoutinglog) error {
	var err error

	return err
}

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

	if o.r.Organization == nil {
		FieldseekerFieldscoutinglogMods.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.FieldseekerFieldscoutinglogs.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 fieldseekerFieldscoutinglog and inserts it into the database
// Relations objects are also inserted and placed in the .R field
// panics if an error occurs
func (o *FieldseekerFieldscoutinglogTemplate) MustCreate(ctx context.Context, exec bob.Executor) *models.FieldseekerFieldscoutinglog {
	m, err := o.Create(ctx, exec)
	if err != nil {
		panic(err)
	}
	return m
}

// CreateOrFail builds a fieldseekerFieldscoutinglog 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 *FieldseekerFieldscoutinglogTemplate) CreateOrFail(ctx context.Context, tb testing.TB, exec bob.Executor) *models.FieldseekerFieldscoutinglog {
	tb.Helper()
	m, err := o.Create(ctx, exec)
	if err != nil {
		tb.Fatal(err)
		return nil
	}
	return m
}

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

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

	return m, nil
}

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

// CreateManyOrFail builds multiple fieldseekerFieldscoutinglogs 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 FieldseekerFieldscoutinglogTemplate) CreateManyOrFail(ctx context.Context, tb testing.TB, exec bob.Executor, number int) models.FieldseekerFieldscoutinglogSlice {
	tb.Helper()
	m, err := o.CreateMany(ctx, exec, number)
	if err != nil {
		tb.Fatal(err)
		return nil
	}
	return m
}

// FieldseekerFieldscoutinglog has methods that act as mods for the FieldseekerFieldscoutinglogTemplate
var FieldseekerFieldscoutinglogMods fieldseekerFieldscoutinglogMods

type fieldseekerFieldscoutinglogMods struct{}

func (m fieldseekerFieldscoutinglogMods) RandomizeAllColumns(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModSlice{
		FieldseekerFieldscoutinglogMods.RandomObjectid(f),
		FieldseekerFieldscoutinglogMods.RandomStatus(f),
		FieldseekerFieldscoutinglogMods.RandomGlobalid(f),
		FieldseekerFieldscoutinglogMods.RandomCreatedUser(f),
		FieldseekerFieldscoutinglogMods.RandomCreatedDate(f),
		FieldseekerFieldscoutinglogMods.RandomLastEditedUser(f),
		FieldseekerFieldscoutinglogMods.RandomLastEditedDate(f),
		FieldseekerFieldscoutinglogMods.RandomCreationdate(f),
		FieldseekerFieldscoutinglogMods.RandomCreator(f),
		FieldseekerFieldscoutinglogMods.RandomEditdate(f),
		FieldseekerFieldscoutinglogMods.RandomEditor(f),
		FieldseekerFieldscoutinglogMods.RandomGeometry(f),
		FieldseekerFieldscoutinglogMods.RandomGeospatial(f),
		FieldseekerFieldscoutinglogMods.RandomVersion(f),
		FieldseekerFieldscoutinglogMods.RandomOrganizationID(f),
	}
}

// Set the model columns to this value
func (m fieldseekerFieldscoutinglogMods) Objectid(val int64) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Objectid = func() int64 { return val }
	})
}

// Set the Column from the function
func (m fieldseekerFieldscoutinglogMods) ObjectidFunc(f func() int64) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Objectid = f
	})
}

// Clear any values for the column
func (m fieldseekerFieldscoutinglogMods) UnsetObjectid() FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) RandomObjectid(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Objectid = func() int64 {
			return random_int64(f)
		}
	})
}

// Set the model columns to this value
func (m fieldseekerFieldscoutinglogMods) Status(val null.Val[int16]) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Status = func() null.Val[int16] { return val }
	})
}

// Set the Column from the function
func (m fieldseekerFieldscoutinglogMods) StatusFunc(f func() null.Val[int16]) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Status = f
	})
}

// Clear any values for the column
func (m fieldseekerFieldscoutinglogMods) UnsetStatus() FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Status = 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 fieldseekerFieldscoutinglogMods) RandomStatus(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Status = 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 fieldseekerFieldscoutinglogMods) RandomStatusNotNull(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Status = 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 fieldseekerFieldscoutinglogMods) Globalid(val uuid.UUID) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Globalid = func() uuid.UUID { return val }
	})
}

// Set the Column from the function
func (m fieldseekerFieldscoutinglogMods) GlobalidFunc(f func() uuid.UUID) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Globalid = f
	})
}

// Clear any values for the column
func (m fieldseekerFieldscoutinglogMods) UnsetGlobalid() FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) RandomGlobalid(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Globalid = func() uuid.UUID {
			return random_uuid_UUID(f)
		}
	})
}

// Set the model columns to this value
func (m fieldseekerFieldscoutinglogMods) CreatedUser(val null.Val[string]) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.CreatedUser = func() null.Val[string] { return val }
	})
}

// Set the Column from the function
func (m fieldseekerFieldscoutinglogMods) CreatedUserFunc(f func() null.Val[string]) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.CreatedUser = f
	})
}

// Clear any values for the column
func (m fieldseekerFieldscoutinglogMods) UnsetCreatedUser() FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) RandomCreatedUser(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) RandomCreatedUserNotNull(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) CreatedDate(val null.Val[time.Time]) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.CreatedDate = func() null.Val[time.Time] { return val }
	})
}

// Set the Column from the function
func (m fieldseekerFieldscoutinglogMods) CreatedDateFunc(f func() null.Val[time.Time]) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.CreatedDate = f
	})
}

// Clear any values for the column
func (m fieldseekerFieldscoutinglogMods) UnsetCreatedDate() FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) RandomCreatedDate(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) RandomCreatedDateNotNull(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) LastEditedUser(val null.Val[string]) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.LastEditedUser = func() null.Val[string] { return val }
	})
}

// Set the Column from the function
func (m fieldseekerFieldscoutinglogMods) LastEditedUserFunc(f func() null.Val[string]) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.LastEditedUser = f
	})
}

// Clear any values for the column
func (m fieldseekerFieldscoutinglogMods) UnsetLastEditedUser() FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) RandomLastEditedUser(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) RandomLastEditedUserNotNull(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) LastEditedDate(val null.Val[time.Time]) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.LastEditedDate = func() null.Val[time.Time] { return val }
	})
}

// Set the Column from the function
func (m fieldseekerFieldscoutinglogMods) LastEditedDateFunc(f func() null.Val[time.Time]) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.LastEditedDate = f
	})
}

// Clear any values for the column
func (m fieldseekerFieldscoutinglogMods) UnsetLastEditedDate() FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) RandomLastEditedDate(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) RandomLastEditedDateNotNull(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) Creationdate(val null.Val[time.Time]) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Creationdate = func() null.Val[time.Time] { return val }
	})
}

// Set the Column from the function
func (m fieldseekerFieldscoutinglogMods) CreationdateFunc(f func() null.Val[time.Time]) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Creationdate = f
	})
}

// Clear any values for the column
func (m fieldseekerFieldscoutinglogMods) UnsetCreationdate() FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) RandomCreationdate(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) RandomCreationdateNotNull(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) Creator(val null.Val[string]) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Creator = func() null.Val[string] { return val }
	})
}

// Set the Column from the function
func (m fieldseekerFieldscoutinglogMods) CreatorFunc(f func() null.Val[string]) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Creator = f
	})
}

// Clear any values for the column
func (m fieldseekerFieldscoutinglogMods) UnsetCreator() FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) RandomCreator(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) RandomCreatorNotNull(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) Editdate(val null.Val[time.Time]) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Editdate = func() null.Val[time.Time] { return val }
	})
}

// Set the Column from the function
func (m fieldseekerFieldscoutinglogMods) EditdateFunc(f func() null.Val[time.Time]) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Editdate = f
	})
}

// Clear any values for the column
func (m fieldseekerFieldscoutinglogMods) UnsetEditdate() FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) RandomEditdate(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) RandomEditdateNotNull(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) Editor(val null.Val[string]) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Editor = func() null.Val[string] { return val }
	})
}

// Set the Column from the function
func (m fieldseekerFieldscoutinglogMods) EditorFunc(f func() null.Val[string]) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Editor = f
	})
}

// Clear any values for the column
func (m fieldseekerFieldscoutinglogMods) UnsetEditor() FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) RandomEditor(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) RandomEditorNotNull(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) Geometry(val types.JSON[json.RawMessage]) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Geometry = func() types.JSON[json.RawMessage] { return val }
	})
}

// Set the Column from the function
func (m fieldseekerFieldscoutinglogMods) GeometryFunc(f func() types.JSON[json.RawMessage]) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Geometry = f
	})
}

// Clear any values for the column
func (m fieldseekerFieldscoutinglogMods) UnsetGeometry() FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) RandomGeometry(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Geometry = func() types.JSON[json.RawMessage] {
			return random_types_JSON_json_RawMessage_(f)
		}
	})
}

// Set the model columns to this value
func (m fieldseekerFieldscoutinglogMods) Geospatial(val null.Val[string]) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Geospatial = func() null.Val[string] { return val }
	})
}

// Set the Column from the function
func (m fieldseekerFieldscoutinglogMods) GeospatialFunc(f func() null.Val[string]) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Geospatial = f
	})
}

// Clear any values for the column
func (m fieldseekerFieldscoutinglogMods) UnsetGeospatial() FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) RandomGeospatial(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) RandomGeospatialNotNull(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) Version(val int32) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Version = func() int32 { return val }
	})
}

// Set the Column from the function
func (m fieldseekerFieldscoutinglogMods) VersionFunc(f func() int32) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Version = f
	})
}

// Clear any values for the column
func (m fieldseekerFieldscoutinglogMods) UnsetVersion() FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) RandomVersion(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.Version = func() int32 {
			return random_int32(f)
		}
	})
}

// Set the model columns to this value
func (m fieldseekerFieldscoutinglogMods) OrganizationID(val int32) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.OrganizationID = func() int32 { return val }
	})
}

// Set the Column from the function
func (m fieldseekerFieldscoutinglogMods) OrganizationIDFunc(f func() int32) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.OrganizationID = f
	})
}

// Clear any values for the column
func (m fieldseekerFieldscoutinglogMods) UnsetOrganizationID() FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		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 fieldseekerFieldscoutinglogMods) RandomOrganizationID(f *faker.Faker) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(_ context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.OrganizationID = func() int32 {
			return random_int32(f)
		}
	})
}

func (m fieldseekerFieldscoutinglogMods) WithParentsCascading() FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(ctx context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		if isDone, _ := fieldseekerFieldscoutinglogWithParentsCascadingCtx.Value(ctx); isDone {
			return
		}
		ctx = fieldseekerFieldscoutinglogWithParentsCascadingCtx.WithValue(ctx, true)
		{

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

func (m fieldseekerFieldscoutinglogMods) WithOrganization(rel *OrganizationTemplate) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(ctx context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.r.Organization = &fieldseekerFieldscoutinglogROrganizationR{
			o: rel,
		}
	})
}

func (m fieldseekerFieldscoutinglogMods) WithNewOrganization(mods ...OrganizationMod) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(ctx context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		related := o.f.NewOrganizationWithContext(ctx, mods...)

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

func (m fieldseekerFieldscoutinglogMods) WithExistingOrganization(em *models.Organization) FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(ctx context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.r.Organization = &fieldseekerFieldscoutinglogROrganizationR{
			o: o.f.FromExistingOrganization(em),
		}
	})
}

func (m fieldseekerFieldscoutinglogMods) WithoutOrganization() FieldseekerFieldscoutinglogMod {
	return FieldseekerFieldscoutinglogModFunc(func(ctx context.Context, o *FieldseekerFieldscoutinglogTemplate) {
		o.r.Organization = nil
	})
}
