package models import "clapclap/internal/uuid" // Genre supports a recursive tree (Sub-genres) and many-to-many track linking. type Genre struct { Base Name string `gorm:"type:varchar(50);uniqueIndex;not null" json:"name"` // Self-referencing tree logic // TODO (pipo) : use anonymous TreeNode[uuid.UUID] field instead ParentID *uuid.UUID `gorm:"type:uuid;index" json:"parent_id,omitempty"` Parent *Genre `gorm:"foreignKey:ParentID" json:"parent,omitempty"` SubGenres []Genre `gorm:"foreignKey:ParentID" json:"sub_genres,omitempty"` // Back-reference to tracks (many2many) Tracks []Track `gorm:"many2many:track_genres;" json:"tracks,omitempty"` }