package channel import ( "time" "github.com/gochat/gochat/internal/model" "gorm.io/datatypes" ) // ChannelAPI represents a REST API channel configuration. // Reference: Chatwoot Channel::Api + P2B M2 spec type ChannelAPI struct { ID uint `gorm:"primaryKey" json:"id"` InboxID uint `gorm:"uniqueIndex;not null" json:"inbox_id"` WebhookURL string `gorm:"size:512" json:"webhook_url"` Secret string `gorm:"size:255" json:"secret"` HMACToken string `gorm:"size:255" json:"hmac_token"` HMACMandatory bool `gorm:"column:hmac_mandatory;default:false" json:"hmac_mandatory"` AdditionalAttributes datatypes.JSON `gorm:"type:jsonb;default:'{}'" json:"additional_attributes"` Identifier string `gorm:"size:255" json:"identifier"` CreatedAt time.Time `gorm:"autoCreateTime" json:"created_at"` UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"` Inbox model.Inbox `gorm:"foreignKey:InboxID" json:"inbox,omitempty"` } func (ChannelAPI) TableName() string { return "channel_api" } func (c ChannelAPI) GetInboxID() uint { return c.InboxID } func (c ChannelAPI) GetChannelType() model.InboxChannelType { return model.InboxChannelTypeAPI }