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

package costexplorer

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

// Returns the name, Amazon Resource Name (ARN), rules, definition, and effective
// dates of a cost category that's defined in the account.
//
// You have the option to use EffectiveOn to return a cost category that's active
// on a specific date. If there's no EffectiveOn specified, you see a Cost
// Category that's effective on the current date. If cost category is still
// effective, EffectiveEnd is omitted in the response.
func (c *Client) DescribeCostCategoryDefinition(ctx context.Context, params *DescribeCostCategoryDefinitionInput, optFns ...func(*Options)) (*DescribeCostCategoryDefinitionOutput, error) {
	if params == nil {
		params = &DescribeCostCategoryDefinitionInput{}
	}

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

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

type DescribeCostCategoryDefinitionInput struct {

	// The unique identifier for your cost category.
	//
	// This member is required.
	CostCategoryArn *string

	// The date when the cost category was effective.
	EffectiveOn *string

	noSmithyDocumentSerde
}

type DescribeCostCategoryDefinitionOutput struct {

	// The structure of Cost Categories. This includes detailed metadata and the set
	// of rules for the CostCategory object.
	CostCategory *types.CostCategory

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

	noSmithyDocumentSerde
}

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