package models

import (
	"time"

	"github.com/google/uuid"
)

// PostTag represents tags used for blog posts.
type PostTag struct {
	ID        uuid.UUID `gorm:"type:uuid;default:gen_random_uuid();primaryKey" json:"id"`
	Tag       string    `gorm:"type:varchar(254);not null" json:"tag"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	IsActive  bool      `gorm:"default:true" json:"is_active"`
	Posts     []Post    `gorm:"many2many:post_post_tags;" json:"posts,omitempty"`
}

// TableName overrides the table name used by PostTag.
func (PostTag) TableName() string {
	return "post_tags"
}
