// 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"
)

// Deletes the specified fields containing personally identifiable information
// (PII) from a contact in the specified Connect Customer instance. This operation
// redacts PII (such as customer endpoints, additional email recipients, and the
// email subject) from the contact and its associated contact trace record (CTR).
// The contact must be in a terminated state.
//
// This operation performs a hard deletion of the specified PII and cannot be
// undone. There is no retention period; after the data is deleted, it cannot be
// recovered. Only fields that Connect Customer identifies and stores as PII are
// removed. Any PII that you place in fields outside the scope of this operation
// remains your responsibility to remove.
func (c *Client) DeleteContactData(ctx context.Context, params *DeleteContactDataInput, optFns ...func(*Options)) (*DeleteContactDataOutput, error) {
	if params == nil {
		params = &DeleteContactDataInput{}
	}

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

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

type DeleteContactDataInput struct {

	// The categories of PII to redact from the contact. Valid values are
	// CUSTOMER_ENDPOINT , ADDITIONAL_EMAIL_RECIPIENTS , and EMAIL_SUBJECT .
	// ADDITIONAL_EMAIL_RECIPIENTS and EMAIL_SUBJECT are supported only for contacts
	// in the email channel.
	//
	// This member is required.
	ContactFields []types.ContactField

	// The identifier of the contact. PII can be deleted only from a contact that has
	// been disconnected (is in a terminated state).
	//
	// This member is required.
	ContactId *string

	// The identifier of the Connect Customer 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

	noSmithyDocumentSerde
}

type DeleteContactDataOutput struct {
	// Metadata pertaining to the operation's result.
	ResultMetadata middleware.Metadata

	noSmithyDocumentSerde
}

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