package model

import "github.com/rs/zerolog"

type UpdateItem struct {
	MessageSequenceNumber int           `json:"messageSequenceNumber"`
	Conversation          *Conversation `json:"conversation,omitempty"`
	Message               *Message      `json:"message,omitempty"`
}

func New(conversation *Conversation, message *Message) *UpdateItem {
	return &UpdateItem{
		Conversation: conversation,
		Message:      message,
	}
}

func (i *UpdateItem) MarshalZerologObject(e *zerolog.Event) {
	e.Int("messageSequenceNumber", i.MessageSequenceNumber)
	if i.Conversation != nil {
		e.Object("conversation", i.Conversation)
	}
	if i.Message != nil {
		e.Object("message", i.Message)
	}
}
