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

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

type ModelPublicPlanGuardrails struct {
	bun.BaseModel  `bun:"table:public.plan_guardrails,alias:plan_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,unique:uidx_plan_guardrails_plan_id_guardrail_id," json:"guardrail_id"`
	PlanID         int64                           `bun:"plan_id,type:bigint,notnull,unique:uidx_plan_guardrails_plan_id_guardrail_id," json:"plan_id"`
	RelGuardrailID *ModelPublicAgentGuardrails     `bun:"rel:has-one,join:guardrail_id=id" json:"relguardrailid,omitempty"` // Has one ModelPublicAgentGuardrails
	RelPlanID      *ModelPublicPlans               `bun:"rel:has-one,join:plan_id=id" json:"relplanid,omitempty"`           // Has one ModelPublicPlans
}

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

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

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

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

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

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

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

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

// GetPrefix returns the table prefix
func (m ModelPublicPlanGuardrails) GetPrefix() string {
	return "PGL"
}
