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

package chatbot

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

// Updates AWS Chatbot account preferences.
func (c *Client) UpdateAccountPreferences(ctx context.Context, params *UpdateAccountPreferencesInput, optFns ...func(*Options)) (*UpdateAccountPreferencesOutput, error) {
	if params == nil {
		params = &UpdateAccountPreferencesInput{}
	}

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

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

type UpdateAccountPreferencesInput struct {

	// Turns on training data collection.
	//
	// This helps improve the AWS Chatbot experience by allowing AWS Chatbot to store
	// and use your customer information, such as AWS Chatbot configurations,
	// notifications, user inputs, AWS Chatbot generated responses, and interaction
	// data. This data helps us to continuously improve and develop Artificial
	// Intelligence (AI) technologies. Your data is not shared with any third parties
	// and is protected using sophisticated controls to prevent unauthorized access and
	// misuse. AWS Chatbot does not store or use interactions in chat channels with
	// Amazon Q for training AI technologies for AWS Chatbot.
	TrainingDataCollectionEnabled *bool

	// Enables use of a user role requirement in your chat configuration.
	UserAuthorizationRequired *bool

	noSmithyDocumentSerde
}

type UpdateAccountPreferencesOutput struct {

	// Preferences related to AWS Chatbot usage in the calling AWS account.
	AccountPreferences *types.AccountPreferences

	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata

	noSmithyDocumentSerde
}

func (c *Client) addOperationUpdateAccountPreferencesMiddlewares(stack *middleware.Stack, options Options) (err error) {
	err = stack.Serialize.Add(&awsRestjson1_serializeOpUpdateAccountPreferences{}, middleware.After)
	if err != nil {
		return err
	}
	err = stack.Deserialize.Add(&awsRestjson1_deserializeOpUpdateAccountPreferences{}, 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, options); 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 = stack.Initialize.Add(newServiceMetadataMiddleware(options.Region, "UpdateAccountPreferences"), 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
}
