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

package b2bi

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

// Retrieves the details for the transformer specified by the transformer ID. A
// transformer can take an EDI file as input and transform it into a JSON-or
// XML-formatted document. Alternatively, a transformer can take a JSON-or
// XML-formatted document as input and transform it into an EDI file.
func (c *Client) GetTransformer(ctx context.Context, params *GetTransformerInput, optFns ...func(*Options)) (*GetTransformerOutput, error) {
	if params == nil {
		params = &GetTransformerInput{}
	}

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

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

type GetTransformerInput struct {

	// Specifies the system-assigned unique identifier for the transformer.
	//
	// This member is required.
	TransformerId *string

	noSmithyDocumentSerde
}

type GetTransformerOutput struct {

	// Returns a timestamp for creation date and time of the transformer.
	//
	// This member is required.
	CreatedAt *time.Time

	// Returns the name of the transformer, used to identify it.
	//
	// This member is required.
	Name *string

	// Returns the state of the newly created transformer. The transformer can be
	// either active or inactive . For the transformer to be used in a capability, its
	// status must active .
	//
	// This member is required.
	Status types.TransformerStatus

	// Returns an Amazon Resource Name (ARN) for a specific Amazon Web Services
	// resource, such as a capability, partnership, profile, or transformer.
	//
	// This member is required.
	TransformerArn *string

	// Returns the system-assigned unique identifier for the transformer.
	//
	// This member is required.
	TransformerId *string

	// Returns the details for the EDI standard that is being used for the
	// transformer. Currently, only X12 is supported. X12 is a set of standards and
	// corresponding messages that define specific business documents.
	//
	// Deprecated: This is a legacy trait. Please use input-conversion or
	// output-conversion.
	EdiType types.EdiType

	// Returns that the currently supported file formats for EDI transformations are
	// JSON and XML .
	//
	// Deprecated: This is a legacy trait. Please use input-conversion or
	// output-conversion.
	FileFormat types.FileFormat

	// Returns the InputConversion object, which contains the format options for the
	// inbound transformation.
	InputConversion *types.InputConversion

	// Returns the structure that contains the mapping template and its language
	// (either XSLT or JSONATA).
	Mapping *types.Mapping

	// Returns the mapping template for the transformer. This template is used to map
	// the parsed EDI file using JSONata or XSLT.
	//
	// Deprecated: This is a legacy trait. Please use input-conversion or
	// output-conversion.
	MappingTemplate *string

	// Returns a timestamp for last time the transformer was modified.
	ModifiedAt *time.Time

	// Returns the OutputConversion object, which contains the format options for the
	// outbound transformation.
	OutputConversion *types.OutputConversion

	// Returns a sample EDI document that is used by a transformer as a guide for
	// processing the EDI data.
	//
	// Deprecated: This is a legacy trait. Please use input-conversion or
	// output-conversion.
	SampleDocument *string

	// Returns a structure that contains the Amazon S3 bucket and an array of the
	// corresponding keys used to identify the location for your sample documents.
	SampleDocuments *types.SampleDocuments

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

	noSmithyDocumentSerde
}

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