package models

import (
	"time"

	"github.com/google/uuid"
)

// Resume model structure
// Represents resume section headers.
type Resume struct {
	ID           uuid.UUID    `gorm:"type:uuid;default:gen_random_uuid();primaryKey" json:"id"`
	Title        string       `gorm:"type:varchar(254);not null" json:"title"`
	TitleSub     string       `gorm:"type:varchar(254);not null" json:"title_sub"`
	Education    string       `gorm:"type:varchar(100);default:Education" json:"education"`
	Experience   string       `gorm:"type:varchar(100);default:Experience" json:"experience"`
	CodingSkills string       `gorm:"type:varchar(100);default:Coding Skills" json:"coding_skills"`
	Knowledge    string       `gorm:"type:varchar(100);default:Knowledge" json:"knowledge"`
	IsActive     bool         `gorm:"default:false" json:"is_active"`
	Educations   []Education  `gorm:"foreignKey:ResumeID" json:"educations,omitempty"`
	Experiences  []Experience `gorm:"foreignKey:ResumeID" json:"experiences,omitempty"`
	Skills       []Skill      `gorm:"foreignKey:ResumeID" json:"skills,omitempty"`
	Knowledges   []Knowledge  `gorm:"foreignKey:ResumeID" json:"knowledges,omitempty"`
	CreatedAt    time.Time    `json:"created_at"`
	UpdatedAt    time.Time    `json:"updated_at"`
}

// TableName overrides the table name used by Resume to `resumes`
func (Resume) TableName() string {
	return "resumes"
}
