// Code generated by relspecgo. DO NOT EDIT.
package generatedmodels

import (
	"fmt"
	resolvespec_common "github.com/bitechdev/ResolveSpec/pkg/spectypes"
	"github.com/uptrace/bun"
)

type ModelPublicThoughts struct {
	bun.BaseModel                      `bun:"table:public.thoughts,alias:thoughts"`
	ID                                 resolvespec_common.SqlInt64     `bun:"id,type:bigserial,pk,autoincrement," json:"id"`
	ArchivedAt                         resolvespec_common.SqlTimeStamp `bun:"archived_at,type:timestamptz,nullzero," json:"archived_at"`
	Content                            resolvespec_common.SqlString    `bun:"content,type:text,notnull," json:"content"`
	CreatedAt                          resolvespec_common.SqlTimeStamp `bun:"created_at,type:timestamptz,default:now(),nullzero," json:"created_at"`
	GUID                               resolvespec_common.SqlUUID      `bun:"guid,type:uuid,default:gen_random_uuid(),notnull," json:"guid"`
	Metadata                           resolvespec_common.SqlJSONB     `bun:"metadata,type:jsonb,default:{}::jsonb,nullzero," json:"metadata"`
	ProjectID                          resolvespec_common.SqlInt64     `bun:"project_id,type:bigint,nullzero," json:"project_id"`
	UpdatedAt                          resolvespec_common.SqlTimeStamp `bun:"updated_at,type:timestamptz,default:now(),nullzero," json:"updated_at"`
	RelProjectID                       *ModelPublicProjects            `bun:"rel:has-one,join:project_id=id" json:"relprojectid,omitempty"`                                // Has one ModelPublicProjects
	RelFromIDPublicThoughtLinks        []*ModelPublicThoughtLinks      `bun:"rel:has-many,join:id=from_id" json:"relfromidpublicthoughtlinks,omitempty"`                   // Has many ModelPublicThoughtLinks
	RelToIDPublicThoughtLinks          []*ModelPublicThoughtLinks      `bun:"rel:has-many,join:id=to_id" json:"reltoidpublicthoughtlinks,omitempty"`                       // Has many ModelPublicThoughtLinks
	RelThoughtIDPublicEmbeddings       []*ModelPublicEmbeddings        `bun:"rel:has-many,join:id=thought_id" json:"relthoughtidpublicembeddings,omitempty"`               // Has many ModelPublicEmbeddings
	RelThoughtIDPublicStoredFiles      []*ModelPublicStoredFiles       `bun:"rel:has-many,join:id=thought_id" json:"relthoughtidpublicstoredfiles,omitempty"`              // Has many ModelPublicStoredFiles
	RelRelatedThoughtIDPublicLearnings []*ModelPublicLearnings         `bun:"rel:has-many,join:id=related_thought_id" json:"relrelatedthoughtidpubliclearnings,omitempty"` // Has many ModelPublicLearnings
}

// TableName returns the table name for ModelPublicThoughts
func (m ModelPublicThoughts) TableName() string {
	return "public.thoughts"
}

// TableNameOnly returns the table name without schema for ModelPublicThoughts
func (m ModelPublicThoughts) TableNameOnly() string {
	return "thoughts"
}

// SchemaName returns the schema name for ModelPublicThoughts
func (m ModelPublicThoughts) SchemaName() string {
	return "public"
}

// GetID returns the primary key value
func (m ModelPublicThoughts) GetID() int64 {
	return m.ID.Int64()
}

// GetIDStr returns the primary key as a string
func (m ModelPublicThoughts) GetIDStr() string {
	return fmt.Sprintf("%v", m.ID)
}

// SetID sets the primary key value
func (m ModelPublicThoughts) SetID(newid int64) {
	m.UpdateID(newid)
}

// UpdateID updates the primary key value
func (m *ModelPublicThoughts) UpdateID(newid int64) {
	m.ID.FromString(fmt.Sprintf("%d", newid))
}

// GetIDName returns the name of the primary key column
func (m ModelPublicThoughts) GetIDName() string {
	return "id"
}

// GetPrefix returns the table prefix
func (m ModelPublicThoughts) GetPrefix() string {
	return "THO"
}
