import {
	ObjectID,
	ObjectInstanceID,
	ObjectVersion,
	Resources,
} from '@hello.nrfcloud.com/proto-map/api'
import { Type } from '@sinclair/typebox'
import { Context } from './Context.js'

/**
 * Similar to the message for `hello.nrfcloud.com/map` but without the deviceId
 * @see https://github.com/hello-nrfcloud/proto-map/blob/616debda859e184952a25a2c6f8224f9feff9df2/api/ObjectUpdate.ts
 */
export const LwM2MObjectUpdate = Type.Object(
	{
		'@context': Type.Literal(Context.lwm2mObjectUpdate.toString()),
		ObjectID,
		ObjectInstanceID: Type.Optional(ObjectInstanceID),
		ObjectVersion: Type.Optional(ObjectVersion),
		Resources,
	},
	{
		title: 'Object update',
		description: 'Describes an update to a LwM2M object for a device.',
	},
)
