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

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

type ModelPublicProjectGuardrails struct {
	bun.BaseModel  `bun:"table:public.project_guardrails,alias:project_guardrails"`
	ID             resolvespec_common.SqlInt64     `bun:"id,type:bigserial,pk,autoincrement," json:"id"`
	CreatedAt      resolvespec_common.SqlTimeStamp `bun:"created_at,type:timestamptz,default:now(),notnull," json:"created_at"`
	GuardrailID    int64                           `bun:"guardrail_id,type:bigint,notnull," json:"guardrail_id"`
	ProjectID      int64                           `bun:"project_id,type:bigint,notnull," json:"project_id"`
	RelGuardrailID *ModelPublicAgentGuardrails     `bun:"rel:has-one,join:guardrail_id=id" json:"relguardrailid,omitempty"` // Has one ModelPublicAgentGuardrails
	RelProjectID   *ModelPublicProjects            `bun:"rel:has-one,join:project_id=id" json:"relprojectid,omitempty"`     // Has one ModelPublicProjects
}

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

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

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

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

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

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

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

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

// GetPrefix returns the table prefix
func (m ModelPublicProjectGuardrails) GetPrefix() string {
	return "PGR"
}
