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

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

type ModelPublicPlanSkills struct {
	bun.BaseModel `bun:"table:public.plan_skills,alias:plan_skills"`
	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"`
	PlanID        int64                           `bun:"plan_id,type:bigint,notnull,unique:uidx_plan_skills_plan_id_skill_id," json:"plan_id"`
	SkillID       int64                           `bun:"skill_id,type:bigint,notnull,unique:uidx_plan_skills_plan_id_skill_id," json:"skill_id"`
	RelPlanID     *ModelPublicPlans               `bun:"rel:has-one,join:plan_id=id" json:"relplanid,omitempty"`   // Has one ModelPublicPlans
	RelSkillID    *ModelPublicAgentSkills         `bun:"rel:has-one,join:skill_id=id" json:"relskillid,omitempty"` // Has one ModelPublicAgentSkills
}

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

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

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

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

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

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

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

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

// GetPrefix returns the table prefix
func (m ModelPublicPlanSkills) GetPrefix() string {
	return "PSL"
}
