package channel

import (
	"time"

	"github.com/gochat/gochat/internal/model"
)

// ChannelSms represents a generic SMS channel configuration.
// Reference: P2B M2 spec (generic SMS provider)
type ChannelSms struct {
	ID           uint      `gorm:"primaryKey" json:"id"`
	InboxID      uint      `gorm:"uniqueIndex;not null" json:"inbox_id"`
	PhoneNumber  string    `gorm:"size:50;not null;index" json:"phone_number"`
	Provider     string    `gorm:"size:50" json:"provider"` // twilio/bandwidth
	ProviderConfig string  `gorm:"type:jsonb" json:"provider_config"`
	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 (ChannelSms) TableName() string { return "channel_sms" }
func (c ChannelSms) GetInboxID() uint                    { return c.InboxID }
func (c ChannelSms) GetChannelType() model.InboxChannelType { return model.InboxChannelTypeSms }