package wechat

import (
	"context"
	"fmt"

	"git.yeij.top/AskaEth/Cyrene/platform-bridge/internal/bridge"
)

// Adapter implements PlatformAdapter for WeChat (Enterprise WeChat / Personal Hook).
// Currently a stub — requires WeChatFerry / ItChat or Enterprise WeChat SDK credentials.
type Adapter struct{}

func NewAdapter() *Adapter { return &Adapter{} }

func (a *Adapter) PlatformName() string { return "wechat" }

func (a *Adapter) Capabilities() bridge.PlatformCapabilities {
	return bridge.PlatformCapabilities{
		MaxMessageLength:   50,
		SupportsMarkdown:   false,
		SupportsImage:      true,
		SupportsVoice:      true,
		SupportsEmoji:      true,
		SupportsReaction:   false,
		SupportsTypingHint: false,
		RecommendBurstMax:  3,
	}
}

func (a *Adapter) Connect(ctx context.Context) error {
	fmt.Println("[wechat] stub adapter — no live connection (requires WeChatFerry/ItChat or Enterprise WeChat SDK)")
	return nil
}

func (a *Adapter) Disconnect(ctx context.Context) error { return nil }

func (a *Adapter) IsConnected() bool { return false }

func (a *Adapter) HealthCheck() error {
	return fmt.Errorf("wechat adapter is a stub — not connected to WeChat")
}

func (a *Adapter) ToUnified(rawMessage interface{}) (*bridge.UnifiedMessage, error) {
	return nil, fmt.Errorf("wechat adapter is a stub — implement with WeChatFerry or Enterprise WeChat SDK")
}

func (a *Adapter) FromUnified(response *bridge.UnifiedResponse) ([]bridge.PlatformMessage, error) {
	return nil, fmt.Errorf("wechat adapter is a stub")
}
