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

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

type ModelPublicStoredFiles struct {
	bun.BaseModel `bun:"table:public.stored_files,alias:stored_files"`
	ID            resolvespec_common.SqlInt64     `bun:"id,type:bigserial,pk,autoincrement," json:"id"`
	Content       []byte                          `bun:"content,type:bytea,notnull," json:"content"`
	CreatedAt     resolvespec_common.SqlTimeStamp `bun:"created_at,type:timestamptz,default:now(),notnull," json:"created_at"`
	Encoding      resolvespec_common.SqlString    `bun:"encoding,type:text,default:'base64',notnull," json:"encoding"`
	GUID          resolvespec_common.SqlUUID      `bun:"guid,type:uuid,default:gen_random_uuid(),notnull," json:"guid"`
	Kind          resolvespec_common.SqlString    `bun:"kind,type:text,default:'file',notnull," json:"kind"`
	MediaType     resolvespec_common.SqlString    `bun:"media_type,type:text,notnull," json:"media_type"`
	Name          resolvespec_common.SqlString    `bun:"name,type:text,notnull," json:"name"`
	ProjectID     resolvespec_common.SqlInt64     `bun:"project_id,type:bigint,nullzero," json:"project_id"`
	Sha256        resolvespec_common.SqlString    `bun:"sha256,type:text,notnull," json:"sha256"`
	SizeBytes     int64                           `bun:"size_bytes,type:bigint,notnull," json:"size_bytes"`
	ThoughtID     resolvespec_common.SqlInt64     `bun:"thought_id,type:bigint,nullzero," json:"thought_id"`
	UpdatedAt     resolvespec_common.SqlTimeStamp `bun:"updated_at,type:timestamptz,default:now(),notnull," json:"updated_at"`
	RelProjectID  *ModelPublicProjects            `bun:"rel:has-one,join:project_id=id" json:"relprojectid,omitempty"` // Has one ModelPublicProjects
	RelThoughtID  *ModelPublicThoughts            `bun:"rel:has-one,join:thought_id=id" json:"relthoughtid,omitempty"` // Has one ModelPublicThoughts
}

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

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

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

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

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

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

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

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

// GetPrefix returns the table prefix
func (m ModelPublicStoredFiles) GetPrefix() string {
	return "SFT"
}
