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

// Retrieves the status and results of a validation process started by [StartEvaluationFormValidation]. Returns
// the current execution status ( IN_PROGRESS , COMPLETED , or FAILED ), the
// validated form version, and when completed, a list of findings that identify
// structural issues and quality improvements for the evaluation form, and may
// include suggested fixes. If the validation failed, a reason is provided
// indicating the cause of the failure.
//
// [StartEvaluationFormValidation]: https://docs.aws.amazon.com/connect/latest/APIReference/API_StartEvaluationFormValidation.html
func (c *Client) GetEvaluationFormValidation(ctx context.Context, params *GetEvaluationFormValidationInput, optFns ...func(*Options)) (*GetEvaluationFormValidationOutput, error) {
	if params == nil {
		params = &GetEvaluationFormValidationInput{}
	}

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

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

type GetEvaluationFormValidationInput struct {

	// The unique identifier for the evaluation form.
	//
	// This member is required.
	EvaluationFormId *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

	// The version of the evaluation form to retrieve validation results for.
	EvaluationFormVersion *int32

	noSmithyDocumentSerde
}

type GetEvaluationFormValidationOutput struct {

	// The unique identifier for the evaluation form.
	//
	// This member is required.
	EvaluationFormId *string

	// A version of the evaluation form.
	//
	// This member is required.
	EvaluationFormVersion int32

	// The timestamp when the validation process was started.
	//
	// This member is required.
	StartedTime *time.Time

	// The current status of the validation process. Valid values: IN_PROGRESS ,
	// COMPLETED , FAILED .
	//
	// This member is required.
	Status types.EvaluationFormValidationStatus

	// The reason the validation failed. This field is populated only when the status
	// is FAILED .
	FailureReason *string

	// A list of findings from the validation process. Each finding identifies a
	// structural issue or quality improvement for the evaluation form, and may include
	// a suggested fix. This field is populated when the status is COMPLETED .
	Findings []types.EvaluationFormValidationFinding

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

	noSmithyDocumentSerde
}

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