package socket

import (
	altv1 "git.toki-labs.com/toki/alt/packages/contracts/gen/go/alt/v1"
	"git.toki-labs.com/toki/alt/packages/domain/trading"
)

func liveCapabilityToProto(c trading.BrokerCapability) *altv1.LiveBrokerCapability {
	cap := &altv1.LiveBrokerCapability{
		Broker:            string(c.Broker),
		SupportsAmend:     c.SupportsAmend,
		SupportsCancel:    c.SupportsCancel,
		SupportsAccount:   c.SupportsAccount,
		SupportsAuditTags: c.SupportsAuditTags,
		CheckedAtUnixMs:   c.CheckedAt.UnixMilli(),
	}
	for m := range c.Markets {
		cap.Markets = append(cap.Markets, marketToProto(m))
	}
	for v := range c.Venues {
		cap.Venues = append(cap.Venues, venueToProto(v))
	}
	for _, t := range c.OrderTypes {
		cap.OrderTypes = append(cap.OrderTypes, string(t))
	}
	return cap
}
