// 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"
	"testing"
	"time"

	"github.com/Gleipnir-Technology/bob"
	enums "github.com/Gleipnir-Technology/nidus-sync/db/enums"
	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/jaswdr/faker/v2"
)

type FileuploadFlyoverAerialServiceMod interface {
	Apply(context.Context, *FileuploadFlyoverAerialServiceTemplate)
}

type FileuploadFlyoverAerialServiceModFunc func(context.Context, *FileuploadFlyoverAerialServiceTemplate)

func (f FileuploadFlyoverAerialServiceModFunc) Apply(ctx context.Context, n *FileuploadFlyoverAerialServiceTemplate) {
	f(ctx, n)
}

type FileuploadFlyoverAerialServiceModSlice []FileuploadFlyoverAerialServiceMod

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

// FileuploadFlyoverAerialServiceTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type FileuploadFlyoverAerialServiceTemplate struct {
	Committed      func() bool
	Condition      func() enums.FileuploadPoolconditiontype
	Created        func() time.Time
	CreatorID      func() int32
	CSVFile        func() int32
	Deleted        func() null.Val[time.Time]
	Geom           func() null.Val[string]
	H3cell         func() null.Val[string]
	ID             func() int32
	OrganizationID func() int32

	r fileuploadFlyoverAerialServiceR
	f *Factory

	alreadyPersisted bool
}

type fileuploadFlyoverAerialServiceR struct {
	CreatorUser  *fileuploadFlyoverAerialServiceRCreatorUserR
	CSVFileCSV   *fileuploadFlyoverAerialServiceRCSVFileCSVR
	Organization *fileuploadFlyoverAerialServiceROrganizationR
}

type fileuploadFlyoverAerialServiceRCreatorUserR struct {
	o *UserTemplate
}
type fileuploadFlyoverAerialServiceRCSVFileCSVR struct {
	o *FileuploadCSVTemplate
}
type fileuploadFlyoverAerialServiceROrganizationR struct {
	o *OrganizationTemplate
}

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

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

	if t.r.CSVFileCSV != nil {
		rel := t.r.CSVFileCSV.o.Build()
		rel.R.CSVFileFlyoverAerialServices = append(rel.R.CSVFileFlyoverAerialServices, o)
		o.CSVFile = rel.FileID // h2
		o.R.CSVFileCSV = rel
	}

	if t.r.Organization != nil {
		rel := t.r.Organization.o.Build()
		rel.R.FlyoverAerialServices = append(rel.R.FlyoverAerialServices, o)
		o.OrganizationID = rel.ID // h2
		o.R.Organization = rel
	}
}

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

	if o.Committed != nil {
		val := o.Committed()
		m.Committed = omit.From(val)
	}
	if o.Condition != nil {
		val := o.Condition()
		m.Condition = omit.From(val)
	}
	if o.Created != nil {
		val := o.Created()
		m.Created = omit.From(val)
	}
	if o.CreatorID != nil {
		val := o.CreatorID()
		m.CreatorID = omit.From(val)
	}
	if o.CSVFile != nil {
		val := o.CSVFile()
		m.CSVFile = omit.From(val)
	}
	if o.Deleted != nil {
		val := o.Deleted()
		m.Deleted = omitnull.FromNull(val)
	}
	if o.Geom != nil {
		val := o.Geom()
		m.Geom = omitnull.FromNull(val)
	}
	if o.H3cell != nil {
		val := o.H3cell()
		m.H3cell = omitnull.FromNull(val)
	}
	if o.ID != nil {
		val := o.ID()
		m.ID = omit.From(val)
	}
	if o.OrganizationID != nil {
		val := o.OrganizationID()
		m.OrganizationID = omit.From(val)
	}

	return m
}

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

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

	return m
}

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

	if o.Committed != nil {
		m.Committed = o.Committed()
	}
	if o.Condition != nil {
		m.Condition = o.Condition()
	}
	if o.Created != nil {
		m.Created = o.Created()
	}
	if o.CreatorID != nil {
		m.CreatorID = o.CreatorID()
	}
	if o.CSVFile != nil {
		m.CSVFile = o.CSVFile()
	}
	if o.Deleted != nil {
		m.Deleted = o.Deleted()
	}
	if o.Geom != nil {
		m.Geom = o.Geom()
	}
	if o.H3cell != nil {
		m.H3cell = o.H3cell()
	}
	if o.ID != nil {
		m.ID = o.ID()
	}
	if o.OrganizationID != nil {
		m.OrganizationID = o.OrganizationID()
	}

	o.setModelRels(m)

	return m
}

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

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

	return m
}

func ensureCreatableFileuploadFlyoverAerialService(m *models.FileuploadFlyoverAerialServiceSetter) {
	if !(m.Committed.IsValue()) {
		val := random_bool(nil)
		m.Committed = omit.From(val)
	}
	if !(m.Condition.IsValue()) {
		val := random_enums_FileuploadPoolconditiontype(nil)
		m.Condition = omit.From(val)
	}
	if !(m.Created.IsValue()) {
		val := random_time_Time(nil)
		m.Created = omit.From(val)
	}
	if !(m.CreatorID.IsValue()) {
		val := random_int32(nil)
		m.CreatorID = omit.From(val)
	}
	if !(m.CSVFile.IsValue()) {
		val := random_int32(nil)
		m.CSVFile = 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.FileuploadFlyoverAerialService
// according to the relationships in the template.
// any required relationship should have already exist on the model
func (o *FileuploadFlyoverAerialServiceTemplate) insertOptRels(ctx context.Context, exec bob.Executor, m *models.FileuploadFlyoverAerialService) error {
	var err error

	return err
}

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

	if o.r.CreatorUser == nil {
		FileuploadFlyoverAerialServiceMods.WithNewCreatorUser().Apply(ctx, o)
	}

	var rel0 *models.User

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

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

	if o.r.CSVFileCSV == nil {
		FileuploadFlyoverAerialServiceMods.WithNewCSVFileCSV().Apply(ctx, o)
	}

	var rel1 *models.FileuploadCSV

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

	opt.CSVFile = omit.From(rel1.FileID)

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

	var rel2 *models.Organization

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

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

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

	m.R.CreatorUser = rel0
	m.R.CSVFileCSV = rel1
	m.R.Organization = rel2

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

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

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

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

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

	return m, nil
}

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

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

// FileuploadFlyoverAerialService has methods that act as mods for the FileuploadFlyoverAerialServiceTemplate
var FileuploadFlyoverAerialServiceMods fileuploadFlyoverAerialServiceMods

type fileuploadFlyoverAerialServiceMods struct{}

func (m fileuploadFlyoverAerialServiceMods) RandomizeAllColumns(f *faker.Faker) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModSlice{
		FileuploadFlyoverAerialServiceMods.RandomCommitted(f),
		FileuploadFlyoverAerialServiceMods.RandomCondition(f),
		FileuploadFlyoverAerialServiceMods.RandomCreated(f),
		FileuploadFlyoverAerialServiceMods.RandomCreatorID(f),
		FileuploadFlyoverAerialServiceMods.RandomCSVFile(f),
		FileuploadFlyoverAerialServiceMods.RandomDeleted(f),
		FileuploadFlyoverAerialServiceMods.RandomGeom(f),
		FileuploadFlyoverAerialServiceMods.RandomH3cell(f),
		FileuploadFlyoverAerialServiceMods.RandomID(f),
		FileuploadFlyoverAerialServiceMods.RandomOrganizationID(f),
	}
}

// Set the model columns to this value
func (m fileuploadFlyoverAerialServiceMods) Committed(val bool) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.Committed = func() bool { return val }
	})
}

// Set the Column from the function
func (m fileuploadFlyoverAerialServiceMods) CommittedFunc(f func() bool) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.Committed = f
	})
}

// Clear any values for the column
func (m fileuploadFlyoverAerialServiceMods) UnsetCommitted() FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.Committed = nil
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m fileuploadFlyoverAerialServiceMods) RandomCommitted(f *faker.Faker) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.Committed = func() bool {
			return random_bool(f)
		}
	})
}

// Set the model columns to this value
func (m fileuploadFlyoverAerialServiceMods) Condition(val enums.FileuploadPoolconditiontype) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.Condition = func() enums.FileuploadPoolconditiontype { return val }
	})
}

// Set the Column from the function
func (m fileuploadFlyoverAerialServiceMods) ConditionFunc(f func() enums.FileuploadPoolconditiontype) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.Condition = f
	})
}

// Clear any values for the column
func (m fileuploadFlyoverAerialServiceMods) UnsetCondition() FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.Condition = nil
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m fileuploadFlyoverAerialServiceMods) RandomCondition(f *faker.Faker) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.Condition = func() enums.FileuploadPoolconditiontype {
			return random_enums_FileuploadPoolconditiontype(f)
		}
	})
}

// Set the model columns to this value
func (m fileuploadFlyoverAerialServiceMods) Created(val time.Time) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.Created = func() time.Time { return val }
	})
}

// Set the Column from the function
func (m fileuploadFlyoverAerialServiceMods) CreatedFunc(f func() time.Time) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.Created = f
	})
}

// Clear any values for the column
func (m fileuploadFlyoverAerialServiceMods) UnsetCreated() FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.Created = nil
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m fileuploadFlyoverAerialServiceMods) RandomCreated(f *faker.Faker) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.Created = func() time.Time {
			return random_time_Time(f)
		}
	})
}

// Set the model columns to this value
func (m fileuploadFlyoverAerialServiceMods) CreatorID(val int32) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.CreatorID = func() int32 { return val }
	})
}

// Set the Column from the function
func (m fileuploadFlyoverAerialServiceMods) CreatorIDFunc(f func() int32) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.CreatorID = f
	})
}

// Clear any values for the column
func (m fileuploadFlyoverAerialServiceMods) UnsetCreatorID() FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.CreatorID = nil
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m fileuploadFlyoverAerialServiceMods) RandomCreatorID(f *faker.Faker) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.CreatorID = func() int32 {
			return random_int32(f)
		}
	})
}

// Set the model columns to this value
func (m fileuploadFlyoverAerialServiceMods) CSVFile(val int32) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.CSVFile = func() int32 { return val }
	})
}

// Set the Column from the function
func (m fileuploadFlyoverAerialServiceMods) CSVFileFunc(f func() int32) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.CSVFile = f
	})
}

// Clear any values for the column
func (m fileuploadFlyoverAerialServiceMods) UnsetCSVFile() FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.CSVFile = nil
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m fileuploadFlyoverAerialServiceMods) RandomCSVFile(f *faker.Faker) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.CSVFile = func() int32 {
			return random_int32(f)
		}
	})
}

// Set the model columns to this value
func (m fileuploadFlyoverAerialServiceMods) Deleted(val null.Val[time.Time]) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.Deleted = func() null.Val[time.Time] { return val }
	})
}

// Set the Column from the function
func (m fileuploadFlyoverAerialServiceMods) DeletedFunc(f func() null.Val[time.Time]) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.Deleted = f
	})
}

// Clear any values for the column
func (m fileuploadFlyoverAerialServiceMods) UnsetDeleted() FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.Deleted = 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 fileuploadFlyoverAerialServiceMods) RandomDeleted(f *faker.Faker) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.Deleted = 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 fileuploadFlyoverAerialServiceMods) RandomDeletedNotNull(f *faker.Faker) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.Deleted = 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 fileuploadFlyoverAerialServiceMods) Geom(val null.Val[string]) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.Geom = func() null.Val[string] { return val }
	})
}

// Set the Column from the function
func (m fileuploadFlyoverAerialServiceMods) GeomFunc(f func() null.Val[string]) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.Geom = f
	})
}

// Clear any values for the column
func (m fileuploadFlyoverAerialServiceMods) UnsetGeom() FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.Geom = 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 fileuploadFlyoverAerialServiceMods) RandomGeom(f *faker.Faker) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.Geom = 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 fileuploadFlyoverAerialServiceMods) RandomGeomNotNull(f *faker.Faker) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.Geom = 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 fileuploadFlyoverAerialServiceMods) H3cell(val null.Val[string]) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.H3cell = func() null.Val[string] { return val }
	})
}

// Set the Column from the function
func (m fileuploadFlyoverAerialServiceMods) H3cellFunc(f func() null.Val[string]) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.H3cell = f
	})
}

// Clear any values for the column
func (m fileuploadFlyoverAerialServiceMods) UnsetH3cell() FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.H3cell = 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 fileuploadFlyoverAerialServiceMods) RandomH3cell(f *faker.Faker) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.H3cell = 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 fileuploadFlyoverAerialServiceMods) RandomH3cellNotNull(f *faker.Faker) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.H3cell = 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 fileuploadFlyoverAerialServiceMods) ID(val int32) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.ID = func() int32 { return val }
	})
}

// Set the Column from the function
func (m fileuploadFlyoverAerialServiceMods) IDFunc(f func() int32) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.ID = f
	})
}

// Clear any values for the column
func (m fileuploadFlyoverAerialServiceMods) UnsetID() FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.ID = nil
	})
}

// Generates a random value for the column using the given faker
// if faker is nil, a default faker is used
func (m fileuploadFlyoverAerialServiceMods) RandomID(f *faker.Faker) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.ID = func() int32 {
			return random_int32(f)
		}
	})
}

// Set the model columns to this value
func (m fileuploadFlyoverAerialServiceMods) OrganizationID(val int32) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.OrganizationID = func() int32 { return val }
	})
}

// Set the Column from the function
func (m fileuploadFlyoverAerialServiceMods) OrganizationIDFunc(f func() int32) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(_ context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.OrganizationID = f
	})
}

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

func (m fileuploadFlyoverAerialServiceMods) WithParentsCascading() FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(ctx context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		if isDone, _ := fileuploadFlyoverAerialServiceWithParentsCascadingCtx.Value(ctx); isDone {
			return
		}
		ctx = fileuploadFlyoverAerialServiceWithParentsCascadingCtx.WithValue(ctx, true)
		{

			related := o.f.NewUserWithContext(ctx, UserMods.WithParentsCascading())
			m.WithCreatorUser(related).Apply(ctx, o)
		}
		{

			related := o.f.NewFileuploadCSVWithContext(ctx, FileuploadCSVMods.WithParentsCascading())
			m.WithCSVFileCSV(related).Apply(ctx, o)
		}
		{

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

func (m fileuploadFlyoverAerialServiceMods) WithCreatorUser(rel *UserTemplate) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(ctx context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.r.CreatorUser = &fileuploadFlyoverAerialServiceRCreatorUserR{
			o: rel,
		}
	})
}

func (m fileuploadFlyoverAerialServiceMods) WithNewCreatorUser(mods ...UserMod) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(ctx context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		related := o.f.NewUserWithContext(ctx, mods...)

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

func (m fileuploadFlyoverAerialServiceMods) WithExistingCreatorUser(em *models.User) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(ctx context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.r.CreatorUser = &fileuploadFlyoverAerialServiceRCreatorUserR{
			o: o.f.FromExistingUser(em),
		}
	})
}

func (m fileuploadFlyoverAerialServiceMods) WithoutCreatorUser() FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(ctx context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.r.CreatorUser = nil
	})
}

func (m fileuploadFlyoverAerialServiceMods) WithCSVFileCSV(rel *FileuploadCSVTemplate) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(ctx context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.r.CSVFileCSV = &fileuploadFlyoverAerialServiceRCSVFileCSVR{
			o: rel,
		}
	})
}

func (m fileuploadFlyoverAerialServiceMods) WithNewCSVFileCSV(mods ...FileuploadCSVMod) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(ctx context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		related := o.f.NewFileuploadCSVWithContext(ctx, mods...)

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

func (m fileuploadFlyoverAerialServiceMods) WithExistingCSVFileCSV(em *models.FileuploadCSV) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(ctx context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.r.CSVFileCSV = &fileuploadFlyoverAerialServiceRCSVFileCSVR{
			o: o.f.FromExistingFileuploadCSV(em),
		}
	})
}

func (m fileuploadFlyoverAerialServiceMods) WithoutCSVFileCSV() FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(ctx context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.r.CSVFileCSV = nil
	})
}

func (m fileuploadFlyoverAerialServiceMods) WithOrganization(rel *OrganizationTemplate) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(ctx context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.r.Organization = &fileuploadFlyoverAerialServiceROrganizationR{
			o: rel,
		}
	})
}

func (m fileuploadFlyoverAerialServiceMods) WithNewOrganization(mods ...OrganizationMod) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(ctx context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		related := o.f.NewOrganizationWithContext(ctx, mods...)

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

func (m fileuploadFlyoverAerialServiceMods) WithExistingOrganization(em *models.Organization) FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(ctx context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.r.Organization = &fileuploadFlyoverAerialServiceROrganizationR{
			o: o.f.FromExistingOrganization(em),
		}
	})
}

func (m fileuploadFlyoverAerialServiceMods) WithoutOrganization() FileuploadFlyoverAerialServiceMod {
	return FileuploadFlyoverAerialServiceModFunc(func(ctx context.Context, o *FileuploadFlyoverAerialServiceTemplate) {
		o.r.Organization = nil
	})
}
