package model import ( "time" "gorm.io/gorm" ) // Tag represents a label/tag used across conversations and contacts. // Reference: Chatwoot Tag + Taggings merged + P2B M4 spec // Each tag belongs to an account and has a unique name within that account. type Tag struct { ID uint `gorm:"primaryKey;autoIncrement" json:"id"` AccountID uint `gorm:"not null;uniqueIndex:idx_tag_account_name" json:"account_id"` Name string `gorm:"size:255;not null;uniqueIndex:idx_tag_account_name" json:"name"` Color string `gorm:"size:50" json:"color,omitempty"` CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"` UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at,omitempty"` Account Account `gorm:"foreignKey:AccountID" json:"account,omitempty"` } func (Tag) TableName() string { return "tags" }