package models import ( "time" ) // LanguageAnalysis represents language analysis for a work type LanguageAnalysis struct { BaseModel Language string `gorm:"size:50;not null"` Analysis JSONB `gorm:"type:jsonb;default:'{}'"` WorkID uint Work *Work `gorm:"foreignKey:WorkID"` } // Gamification represents gamification elements for a user type Gamification struct { BaseModel Points int `gorm:"default:0"` Level int `gorm:"default:1"` Badges JSONB `gorm:"type:jsonb;default:'{}'"` Streaks int `gorm:"default:0"` LastActive *time.Time UserID uint User *User `gorm:"foreignKey:UserID"` } // Stats represents general statistics type Stats struct { BaseModel Data JSONB `gorm:"type:jsonb;default:'{}'"` Period string `gorm:"size:50"` // e.g., daily, weekly, monthly, etc. StartDate time.Time EndDate time.Time UserID *uint User *User `gorm:"foreignKey:UserID"` WorkID *uint Work *Work `gorm:"foreignKey:WorkID"` } // SearchDocument is a denormalized text representation for indexing type SearchDocument struct { BaseModel EntityType string `gorm:"size:50;index"` EntityID uint `gorm:"index"` LanguageCode string `gorm:"size:16;index"` Title string `gorm:"size:512"` Body string `gorm:"type:text"` Keywords string `gorm:"type:text"` }