package channel import "github.com/gochat/gochat/internal/model" // ChannelMicrosoft represents a Microsoft (Azure AD/Teams) channel. // Reference: Chatwoot does not have a native Microsoft channel — this is a gochat addition. // // Enterprise Microsoft integration uses Azure AD OAuth for authentication // and Microsoft Graph API for Teams messaging. // // Features: // - Azure AD OAuth 2.0 authorization flow for enterprise SSO // - Microsoft Teams channel messaging via Graph API // - Outlook email integration potential // - Azure webhook subscriptions for real-time events type ChannelMicrosoft struct { model.Base // Account foreign key AccountID uint `gorm:"index;not null" json:"account_id"` // Inbox foreign key — links to the Inbox that wraps this channel InboxID uint `gorm:"not null;uniqueIndex" json:"inbox_id"` // Azure AD tenant ID — identifies the Azure organization TenantID string `gorm:"size:255;not null" json:"tenant_id"` // Azure AD client/object ID for the application ClientID string `gorm:"size:255;not null" json:"client_id"` // Microsoft Graph API access token AccessToken string `gorm:"size:2048;not null" json:"-"` // OAuth 2.0 refresh token for token renewal RefreshToken string `gorm:"size:2048" json:"-"` // Microsoft Teams team ID (optional — for Teams channel integration) TeamID string `gorm:"size:255" json:"team_id,omitempty"` // Microsoft Teams channel ID (optional — for specific Teams channel) ChannelID string `gorm:"size:255" json:"channel_id,omitempty"` // Display name of the connected Microsoft resource DisplayName string `gorm:"size:255" json:"display_name,omitempty"` // Webhook subscription ID for Graph API subscriptions SubscriptionID string `gorm:"size:255" json:"subscription_id,omitempty"` // Flag indicating reauthorization is required ReauthorizationRequired bool `gorm:"default:false" json:"reauthorization_required,omitempty"` } func (ChannelMicrosoft) TableName() string { return "channel_microsoft" } func (c ChannelMicrosoft) GetChannelBase() ChannelBase { return ChannelBase{ ID: c.ID, AccountID: c.AccountID, InboxID: c.InboxID, ChannelType: "microsoft", } } func (c ChannelMicrosoft) GetChannelType() string { return "microsoft" }