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

// Creates a test case with its content and metadata for the specified Amazon
// Connect instance.
func (c *Client) CreateTestCase(ctx context.Context, params *CreateTestCaseInput, optFns ...func(*Options)) (*CreateTestCaseOutput, error) {
	if params == nil {
		params = &CreateTestCaseInput{}
	}

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

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

type CreateTestCaseInput struct {

	// The JSON string that represents the content of the test.
	//
	// This member is required.
	Content *string

	// The identifier of the Amazon Connect instance.
	//
	// This member is required.
	InstanceId *string

	// The name of the test.
	//
	// This member is required.
	Name *string

	// The description of the test.
	Description *string

	// Defines the starting point for your test.
	EntryPoint *types.TestCaseEntryPoint

	// Defines the initial custom attributes for your test.
	InitializationData *string

	// The region in which the resource was last modified
	LastModifiedRegion *string

	// The time at which the resource was last modified.
	LastModifiedTime *time.Time

	// Indicates the test status as either SAVED or PUBLISHED. The PUBLISHED status
	// will initiate validation on the content. The SAVED status does not initiate
	// validation of the content.
	Status types.TestCaseStatus

	// The tags used to organize, track, or control access for this resource.
	Tags map[string]string

	// Id of the test case if you want to create it in a replica region using Amazon
	// Connect Global Resiliency
	TestCaseId *string

	noSmithyDocumentSerde
}

type CreateTestCaseOutput struct {

	// The Amazon Resource Name (ARN) of the test.
	TestCaseArn *string

	// The identifier of the test.
	TestCaseId *string

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

	noSmithyDocumentSerde
}

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