// Copyright (c) 2016, 2018, 2026, Oracle and/or its affiliates.  All rights reserved.
// This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.
// Code generated. DO NOT EDIT.

// Internet of Things API
//
// Use the Internet of Things (IoT) API to manage IoT domain groups, domains, and digital twin resources including models, adapters, instances, and relationships.
// For more information, see Internet of Things (https://docs.oracle.com/iaas/Content/internet-of-things/home.htm).
//

package iot

import (
	"fmt"
	"github.com/oracle/oci-go-sdk/v65/common"
	"strings"
)

// DigitalTwinAdapterEnvelopeMapping Maps the metadata fields from the inbound payload using JQ.
// These mappings allow you to extract specific metadata such as timestamps using JQ expressions.
type DigitalTwinAdapterEnvelopeMapping struct {

	// JQ expression to extract the observation timestamp from the payload. If not specified,
	// the system will default to using `timeReceived` as the timestamp.
	// Example: For payload `{"time": "<timestamp>","temp": 65,"hum": 55}`
	// 'timeObserved' can be mapped as JQ Expression (https://jqplay.org/) `$.time`.
	TimeObserved *string `mandatory:"false" json:"timeObserved"`

	// Optional. JQ expression to map the target resource, which is externalKey of digital twin instance, the incoming data belongs to.
	Target *string `mandatory:"false" json:"target"`

	// JSON Path string to override the context root before delegating to the adapter of the target digital twin instance.
	ContentRoot *string `mandatory:"false" json:"contentRoot"`
}

func (m DigitalTwinAdapterEnvelopeMapping) String() string {
	return common.PointerString(m)
}

// ValidateEnumValue returns an error when providing an unsupported enum value
// This function is being called during constructing API request process
// Not recommended for calling this function directly
func (m DigitalTwinAdapterEnvelopeMapping) ValidateEnumValue() (bool, error) {
	errMessage := []string{}

	if len(errMessage) > 0 {
		return true, fmt.Errorf("%s", strings.Join(errMessage, "\n"))
	}
	return false, nil
}
