package domain import ( "context" "time" "gorm.io/datatypes" ) // PageStatus represents the publication status of a page type PageStatus string const ( PageStatusDraft PageStatus = "draft" PageStatusPublished PageStatus = "published" PageStatusArchived PageStatus = "archived" ) // PageVisibility represents who can view the page type PageVisibility string const ( PageVisibilityPublic PageVisibility = "public" PageVisibilityPrivate PageVisibility = "private" PageVisibilityAdmin PageVisibility = "admin" ) // StaticPage represents a static content page type StaticPage struct { ID string `gorm:"primaryKey;type:text"` Slug string `gorm:"uniqueIndex;not null;type:text"` Title string `gorm:"type:text;not null"` Content string `gorm:"type:text"` MetaDescription string `gorm:"type:text"` SEOKeywords datatypes.JSON `gorm:"type:jsonb;default:'[]'"` // []string Status PageStatus `gorm:"type:varchar(20);default:'draft'"` Visibility PageVisibility `gorm:"type:varchar(20);default:'public'"` Template string `gorm:"type:varchar(100)"` PublishedAt *time.Time `gorm:"index"` CreatedBy string `gorm:"type:text"` UpdatedBy string `gorm:"type:text"` CreatedAt time.Time `gorm:"autoCreateTime"` UpdatedAt time.Time `gorm:"autoUpdateTime"` } // TableName specifies the table name for GORM func (StaticPage) TableName() string { return "static_pages" } // AnnouncementPriority represents the priority of an announcement type AnnouncementPriority string const ( AnnouncementPriorityLow AnnouncementPriority = "low" AnnouncementPriorityNormal AnnouncementPriority = "normal" AnnouncementPriorityHigh AnnouncementPriority = "high" AnnouncementPriorityUrgent AnnouncementPriority = "urgent" ) // AnnouncementDisplayType represents how the announcement is displayed type AnnouncementDisplayType string const ( AnnouncementDisplayBanner AnnouncementDisplayType = "banner" AnnouncementDisplayModal AnnouncementDisplayType = "modal" AnnouncementDisplayNotification AnnouncementDisplayType = "notification" ) // AnnouncementTargetAudience represents who should see the announcement type AnnouncementTargetAudience string const ( AnnouncementTargetAll AnnouncementTargetAudience = "all" AnnouncementTargetOrganizations AnnouncementTargetAudience = "organizations" AnnouncementTargetUsers AnnouncementTargetAudience = "users" AnnouncementTargetSpecific AnnouncementTargetAudience = "specific" ) // Announcement represents a system announcement type Announcement struct { ID string `gorm:"primaryKey;type:text"` Title string `gorm:"type:text;not null"` Content string `gorm:"type:text;not null"` Priority AnnouncementPriority `gorm:"type:varchar(20);default:'normal'"` DisplayType AnnouncementDisplayType `gorm:"type:varchar(20);default:'banner'"` TargetAudience AnnouncementTargetAudience `gorm:"type:varchar(20);default:'all'"` TargetGroups datatypes.JSON `gorm:"type:jsonb;default:'[]'"` // []string - for specific groups StartDate *time.Time `gorm:"index"` EndDate *time.Time `gorm:"index"` IsActive bool `gorm:"default:true;index"` Views int64 `gorm:"default:0"` Clicks int64 `gorm:"default:0"` Dismissals int64 `gorm:"default:0"` CreatedBy string `gorm:"type:text"` UpdatedBy string `gorm:"type:text"` CreatedAt time.Time `gorm:"autoCreateTime"` UpdatedAt time.Time `gorm:"autoUpdateTime"` } // TableName specifies the table name for GORM func (Announcement) TableName() string { return "announcements" } // MediaAssetType represents the type of media asset type MediaAssetType string const ( MediaAssetTypeImage MediaAssetType = "image" MediaAssetTypeVideo MediaAssetType = "video" MediaAssetTypeDocument MediaAssetType = "document" MediaAssetTypeAudio MediaAssetType = "audio" ) // MediaAsset represents a media file type MediaAsset struct { ID string `gorm:"primaryKey;type:text"` Filename string `gorm:"type:text;not null"` OriginalName string `gorm:"type:text;not null"` URL string `gorm:"type:text;not null"` Type MediaAssetType `gorm:"type:varchar(20);not null;index"` MimeType string `gorm:"type:varchar(100)"` Size int64 `gorm:"type:bigint"` // Size in bytes Width *int `gorm:"type:integer"` // For images/videos Height *int `gorm:"type:integer"` // For images/videos Duration *int `gorm:"type:integer"` // For videos/audio in seconds AltText string `gorm:"type:text"` // For images Tags datatypes.JSON `gorm:"type:jsonb;default:'[]'"` // []string UploadedBy string `gorm:"type:text"` CreatedAt time.Time `gorm:"autoCreateTime;index"` UpdatedAt time.Time `gorm:"autoUpdateTime"` } // TableName specifies the table name for GORM func (MediaAsset) TableName() string { return "media_assets" } // StaticPageRepository defines the interface for static page operations type StaticPageRepository interface { Create(ctx context.Context, page *StaticPage) error GetByID(ctx context.Context, id string) (*StaticPage, error) GetBySlug(ctx context.Context, slug string) (*StaticPage, error) GetAll(ctx context.Context) ([]*StaticPage, error) Update(ctx context.Context, page *StaticPage) error Delete(ctx context.Context, id string) error Search(ctx context.Context, query string) ([]*StaticPage, error) } // AnnouncementRepository defines the interface for announcement operations type AnnouncementRepository interface { Create(ctx context.Context, announcement *Announcement) error GetByID(ctx context.Context, id string) (*Announcement, error) GetAll(ctx context.Context, filters AnnouncementFilters) ([]*Announcement, error) GetActive(ctx context.Context) ([]*Announcement, error) Update(ctx context.Context, announcement *Announcement) error Delete(ctx context.Context, id string) error RecordView(ctx context.Context, id string) error RecordClick(ctx context.Context, id string) error RecordDismissal(ctx context.Context, id string) error } type AnnouncementFilters struct { IsActive *bool Priority *AnnouncementPriority StartDate *time.Time EndDate *time.Time } // MediaAssetRepository defines the interface for media asset operations type MediaAssetRepository interface { Create(ctx context.Context, asset *MediaAsset) error GetByID(ctx context.Context, id string) (*MediaAsset, error) GetAll(ctx context.Context, filters MediaAssetFilters) ([]*MediaAsset, error) Update(ctx context.Context, asset *MediaAsset) error Delete(ctx context.Context, id string) error Search(ctx context.Context, query string) ([]*MediaAsset, error) } type MediaAssetFilters struct { Type *MediaAssetType Tags []string }