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

	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/jaswdr/faker/v2"
)

type PublicreportReportLocationMod interface {
	Apply(context.Context, *PublicreportReportLocationTemplate)
}

type PublicreportReportLocationModFunc func(context.Context, *PublicreportReportLocationTemplate)

func (f PublicreportReportLocationModFunc) Apply(ctx context.Context, n *PublicreportReportLocationTemplate) {
	f(ctx, n)
}

type PublicreportReportLocationModSlice []PublicreportReportLocationMod

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

// PublicreportReportLocationTemplate is an object representing the database table.
// all columns are optional and should be set by mods
type PublicreportReportLocationTemplate struct {
	ID        func() null.Val[int64]
	TableName func() null.Val[string]
	Address   func() null.Val[string]
	Created   func() null.Val[time.Time]
	Location  func() null.Val[string]
	PublicID  func() null.Val[string]
	Status    func() null.Val[enums.PublicreportReportstatustype]

	f *Factory

	alreadyPersisted bool
}

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

// setModelRels creates and sets the relationships on *models.PublicreportReportLocation
// according to the relationships in the template. Nothing is inserted into the db
func (t PublicreportReportLocationTemplate) setModelRels(o *models.PublicreportReportLocation) {}

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

	if o.ID != nil {
		m.ID = o.ID()
	}
	if o.TableName != nil {
		m.TableName = o.TableName()
	}
	if o.Address != nil {
		m.Address = o.Address()
	}
	if o.Created != nil {
		m.Created = o.Created()
	}
	if o.Location != nil {
		m.Location = o.Location()
	}
	if o.PublicID != nil {
		m.PublicID = o.PublicID()
	}
	if o.Status != nil {
		m.Status = o.Status()
	}

	o.setModelRels(m)

	return m
}

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

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

	return m
}

// PublicreportReportLocation has methods that act as mods for the PublicreportReportLocationTemplate
var PublicreportReportLocationMods publicreportReportLocationMods

type publicreportReportLocationMods struct{}

func (m publicreportReportLocationMods) RandomizeAllColumns(f *faker.Faker) PublicreportReportLocationMod {
	return PublicreportReportLocationModSlice{
		PublicreportReportLocationMods.RandomID(f),
		PublicreportReportLocationMods.RandomTableName(f),
		PublicreportReportLocationMods.RandomAddress(f),
		PublicreportReportLocationMods.RandomCreated(f),
		PublicreportReportLocationMods.RandomLocation(f),
		PublicreportReportLocationMods.RandomPublicID(f),
		PublicreportReportLocationMods.RandomStatus(f),
	}
}

// Set the model columns to this value
func (m publicreportReportLocationMods) ID(val null.Val[int64]) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.ID = func() null.Val[int64] { return val }
	})
}

// Set the Column from the function
func (m publicreportReportLocationMods) IDFunc(f func() null.Val[int64]) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.ID = f
	})
}

// Clear any values for the column
func (m publicreportReportLocationMods) UnsetID() PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.ID = 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 publicreportReportLocationMods) RandomID(f *faker.Faker) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.ID = func() null.Val[int64] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_int64(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 publicreportReportLocationMods) RandomIDNotNull(f *faker.Faker) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.ID = func() null.Val[int64] {
			if f == nil {
				f = &defaultFaker
			}

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

// Set the model columns to this value
func (m publicreportReportLocationMods) TableName(val null.Val[string]) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.TableName = func() null.Val[string] { return val }
	})
}

// Set the Column from the function
func (m publicreportReportLocationMods) TableNameFunc(f func() null.Val[string]) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.TableName = f
	})
}

// Clear any values for the column
func (m publicreportReportLocationMods) UnsetTableName() PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.TableName = 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 publicreportReportLocationMods) RandomTableName(f *faker.Faker) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.TableName = 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 publicreportReportLocationMods) RandomTableNameNotNull(f *faker.Faker) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.TableName = 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 publicreportReportLocationMods) Address(val null.Val[string]) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.Address = func() null.Val[string] { return val }
	})
}

// Set the Column from the function
func (m publicreportReportLocationMods) AddressFunc(f func() null.Val[string]) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.Address = f
	})
}

// Clear any values for the column
func (m publicreportReportLocationMods) UnsetAddress() PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.Address = 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 publicreportReportLocationMods) RandomAddress(f *faker.Faker) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.Address = 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 publicreportReportLocationMods) RandomAddressNotNull(f *faker.Faker) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.Address = 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 publicreportReportLocationMods) Created(val null.Val[time.Time]) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.Created = func() null.Val[time.Time] { return val }
	})
}

// Set the Column from the function
func (m publicreportReportLocationMods) CreatedFunc(f func() null.Val[time.Time]) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.Created = f
	})
}

// Clear any values for the column
func (m publicreportReportLocationMods) UnsetCreated() PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.Created = 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 publicreportReportLocationMods) RandomCreated(f *faker.Faker) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.Created = 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 publicreportReportLocationMods) RandomCreatedNotNull(f *faker.Faker) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.Created = 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 publicreportReportLocationMods) Location(val null.Val[string]) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.Location = func() null.Val[string] { return val }
	})
}

// Set the Column from the function
func (m publicreportReportLocationMods) LocationFunc(f func() null.Val[string]) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.Location = f
	})
}

// Clear any values for the column
func (m publicreportReportLocationMods) UnsetLocation() PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.Location = 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 publicreportReportLocationMods) RandomLocation(f *faker.Faker) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.Location = 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 publicreportReportLocationMods) RandomLocationNotNull(f *faker.Faker) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.Location = 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 publicreportReportLocationMods) PublicID(val null.Val[string]) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.PublicID = func() null.Val[string] { return val }
	})
}

// Set the Column from the function
func (m publicreportReportLocationMods) PublicIDFunc(f func() null.Val[string]) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.PublicID = f
	})
}

// Clear any values for the column
func (m publicreportReportLocationMods) UnsetPublicID() PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.PublicID = 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 publicreportReportLocationMods) RandomPublicID(f *faker.Faker) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.PublicID = 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 publicreportReportLocationMods) RandomPublicIDNotNull(f *faker.Faker) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.PublicID = 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 publicreportReportLocationMods) Status(val null.Val[enums.PublicreportReportstatustype]) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.Status = func() null.Val[enums.PublicreportReportstatustype] { return val }
	})
}

// Set the Column from the function
func (m publicreportReportLocationMods) StatusFunc(f func() null.Val[enums.PublicreportReportstatustype]) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.Status = f
	})
}

// Clear any values for the column
func (m publicreportReportLocationMods) UnsetStatus() PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		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 publicreportReportLocationMods) RandomStatus(f *faker.Faker) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.Status = func() null.Val[enums.PublicreportReportstatustype] {
			if f == nil {
				f = &defaultFaker
			}

			val := random_enums_PublicreportReportstatustype(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 publicreportReportLocationMods) RandomStatusNotNull(f *faker.Faker) PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(_ context.Context, o *PublicreportReportLocationTemplate) {
		o.Status = func() null.Val[enums.PublicreportReportstatustype] {
			if f == nil {
				f = &defaultFaker
			}

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

func (m publicreportReportLocationMods) WithParentsCascading() PublicreportReportLocationMod {
	return PublicreportReportLocationModFunc(func(ctx context.Context, o *PublicreportReportLocationTemplate) {
		if isDone, _ := publicreportReportLocationWithParentsCascadingCtx.Value(ctx); isDone {
			return
		}
		ctx = publicreportReportLocationWithParentsCascadingCtx.WithValue(ctx, true)
	})
}
