package model import ( "encoding/json" ) // Portal represents a help center / knowledge base portal. // Reference: Chatwoot Portal model + P2B M9 spec type Portal struct { Base AccountID uint `gorm:"index;not null" json:"account_id"` Name string `gorm:"size:255;not null" json:"name"` Slug string `gorm:"size:255;not null;uniqueIndex" json:"slug"` Description string `gorm:"type:text" json:"description"` LogoURL string `gorm:"size:512" json:"logo_url"` HeaderText string `gorm:"type:text" json:"header_text"` HomepageLink string `gorm:"size:255" json:"homepage_link"` PageTitle string `gorm:"size:255" json:"page_title"` Color string `gorm:"size:20;default:'#1f93ff'" json:"color"` Archived bool `gorm:"default:false" json:"archived"` CustomDomain string `gorm:"size:255" json:"custom_domain"` Locale string `gorm:"size:10;default:'en'" json:"locale"` PortalConfiguration json.RawMessage `gorm:"type:jsonb;serializer:json" json:"portal_configuration"` // allowed_locales, default_locale, layout, social_profiles SSLSettings json.RawMessage `gorm:"type:jsonb;default:'{}';serializer:json" json:"ssl_settings"` ChannelWebWidgetID *uint `gorm:"index" json:"channel_web_widget_id,omitempty"` HomepageContent string `gorm:"type:text" json:"homepage_content"` Account Account `gorm:"foreignKey:AccountID" json:"account,omitempty"` Categories []Category `gorm:"foreignKey:PortalID" json:"categories,omitempty"` Members []PortalMember `gorm:"foreignKey:PortalID" json:"members,omitempty"` Folders []Folder `gorm:"foreignKey:PortalID" json:"folders,omitempty"` Articles []Article `gorm:"foreignKey:PortalID" json:"articles,omitempty"` } // PortalSSLStatus is a read-only DTO for the SSL status of a portal. // Reference: Chatwoot portals_controller#ssl_status type PortalSSLStatus struct { PortalID uint `json:"portal_id"` CustomDomain string `json:"custom_domain"` SSLState string `json:"ssl_state"` // no_custom_domain, pending, success, error CertificateExpiry string `json:"certificate_expiry,omitempty"` CNAMEValid bool `json:"cname_valid"` } func (Portal) TableName() string { return "portals" }