// Code generated by smithy-go-codegen DO NOT EDIT.

package connect

import (
	"context"
	"github.com/aws/aws-sdk-go-v2/service/connect/types"
	"github.com/aws/smithy-go/middleware"
	smithyhttp "github.com/aws/smithy-go/transport/http"
	"time"
)

// Updates the status of a notification for a specific user, such as marking it as
// read or hidden. Users can only update notification status for notifications that
// have been sent to them. READ status deprioritizes the notification and greys it
// out, while HIDDEN status removes it from the notification widget.
func (c *Client) UpdateUserNotificationStatus(ctx context.Context, params *UpdateUserNotificationStatusInput, optFns ...func(*Options)) (*UpdateUserNotificationStatusOutput, error) {
	if params == nil {
		params = &UpdateUserNotificationStatusInput{}
	}

	result, metadata, err := c.invokeOperation(ctx, "UpdateUserNotificationStatus", params, optFns, c.addOperationUpdateUserNotificationStatusMiddlewares)
	if err != nil {
		return nil, err
	}

	out := result.(*UpdateUserNotificationStatusOutput)
	out.ResultMetadata = metadata
	return out, nil
}

type UpdateUserNotificationStatusInput struct {

	// The identifier of the Amazon Connect instance. You can [find the instance ID] in the Amazon Resource
	// Name (ARN) of the instance.
	//
	// [find the instance ID]: https://docs.aws.amazon.com/connect/latest/adminguide/find-instance-arn.html
	//
	// This member is required.
	InstanceId *string

	// The unique identifier for the notification.
	//
	// This member is required.
	NotificationId *string

	// The new status for the notification. Valid values are READ, UNREAD, and HIDDEN.
	//
	// This member is required.
	Status types.NotificationStatus

	// The identifier of the user whose notification status is being updated.
	//
	// This member is required.
	UserId *string

	// The AWS Region where the notification status was last modified. Used for
	// cross-region replication.
	LastModifiedRegion *string

	// The timestamp when the notification status was last modified. Used for
	// cross-region replication and optimistic locking.
	LastModifiedTime *time.Time

	noSmithyDocumentSerde
}

// The response from updating a user's notification status.
type UpdateUserNotificationStatusOutput struct {
	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata

	noSmithyDocumentSerde
}

func (c *Client) addOperationUpdateUserNotificationStatusMiddlewares(stack *middleware.Stack, options Options) (err error) {
	err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateUserNotificationStatus{}, middleware.After)
	if err != nil {
		return err
	}
	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateUserNotificationStatus{}, middleware.After)
	if err != nil {
		return err
	}

	if err = addlegacyEndpointContextSetter(stack, options); err != nil {
		return err
	}
	if err = addComputeContentLength(stack); err != nil {
		return err
	}
	if err = addResolveEndpointMiddleware(stack, options); err != nil {
		return err
	}
	if err = addComputePayloadSHA256(stack); err != nil {
		return err
	}
	if err = addRecordResponseTiming(stack); err != nil {
		return err
	}
	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
		return err
	}
	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
		return err
	}
	if err = addCredentialSource(stack, options); err != nil {
		return err
	}
	if err = addOpUpdateUserNotificationStatusValidationMiddleware(stack); err != nil {
		return err
	}
	if err = stack.Initialize.Add(newServiceMetadataMiddleware(options.Region, "UpdateUserNotificationStatus"), middleware.Before); err != nil {
		return err
	}
	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
		return err
	}
	if err = addResponseErrorMiddleware(stack); err != nil {
		return err
	}
	if err = addRequestResponseLogging(stack, options); err != nil {
		return err
	}
	if err = addDisableHTTPSMiddleware(stack, options); err != nil {
		return err
	}
	if err = addInterceptors(stack, options); err != nil {
		return err
	}
	return nil
}
