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

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

type ModelPublicProjects struct {
	bun.BaseModel                       `bun:"table:public.projects,alias:projects"`
	ID                                  resolvespec_common.SqlInt64     `bun:"id,type:bigserial,pk,autoincrement," json:"id"`
	CreatedAt                           resolvespec_common.SqlTimeStamp `bun:"created_at,type:timestamptz,default:now(),nullzero," json:"created_at"`
	Description                         resolvespec_common.SqlString    `bun:"description,type:text,nullzero," json:"description"`
	GUID                                resolvespec_common.SqlUUID      `bun:"guid,type:uuid,default:gen_random_uuid(),notnull," json:"guid"`
	LastActiveAt                        resolvespec_common.SqlTimeStamp `bun:"last_active_at,type:timestamptz,default:now(),nullzero," json:"last_active_at"`
	Name                                resolvespec_common.SqlString    `bun:"name,type:text,notnull," json:"name"`
	ThoughtCount                        resolvespec_common.SqlInt64     `bun:"thought_count,scanonly" json:"thought_count"`
	RelProjectIDPublicThoughts          []*ModelPublicThoughts          `bun:"rel:has-many,join:id=project_id" json:"relprojectidpublicthoughts,omitempty"`          // Has many ModelPublicThoughts
	RelProjectIDPublicStoredFiles       []*ModelPublicStoredFiles       `bun:"rel:has-many,join:id=project_id" json:"relprojectidpublicstoredfiles,omitempty"`       // Has many ModelPublicStoredFiles
	RelProjectIDPublicChatHistories     []*ModelPublicChatHistories     `bun:"rel:has-many,join:id=project_id" json:"relprojectidpublicchathistories,omitempty"`     // Has many ModelPublicChatHistories
	RelProjectIDPublicLearnings         []*ModelPublicLearnings         `bun:"rel:has-many,join:id=project_id" json:"relprojectidpubliclearnings,omitempty"`         // Has many ModelPublicLearnings
	RelProjectIDPublicPlans             []*ModelPublicPlans             `bun:"rel:has-many,join:id=project_id" json:"relprojectidpublicplans,omitempty"`             // Has many ModelPublicPlans
	RelProjectIDPublicProjectSkills     []*ModelPublicProjectSkills     `bun:"rel:has-many,join:id=project_id" json:"relprojectidpublicprojectskills,omitempty"`     // Has many ModelPublicProjectSkills
	RelProjectIDPublicProjectGuardrails []*ModelPublicProjectGuardrails `bun:"rel:has-many,join:id=project_id" json:"relprojectidpublicprojectguardrails,omitempty"` // Has many ModelPublicProjectGuardrails
}

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

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

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

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

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

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

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

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

// GetPrefix returns the table prefix
func (m ModelPublicProjects) GetPrefix() string {
	return "PRO"
}
