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

package awscryptographyencryptionsdksmithygeneratedtypes

import (
	"fmt"
	"unicode/utf8"

	"github.com/aws/aws-cryptographic-material-providers-library/releases/go/mpl/awscryptographymaterialproviderssmithygeneratedtypes"
)

type DecryptInput struct {
	Ciphertext []byte

	EncryptionContext map[string]string

	Keyring awscryptographymaterialproviderssmithygeneratedtypes.IKeyring

	MaterialsManager awscryptographymaterialproviderssmithygeneratedtypes.ICryptographicMaterialsManager
}

func (input DecryptInput) Validate() error {
	if input.Aws_cryptography_encryptionSdk_DecryptInput_encryptionContext_Validate() != nil {
		return input.Aws_cryptography_encryptionSdk_DecryptInput_encryptionContext_Validate()
	}

	return nil
}

func (input DecryptInput) Aws_cryptography_encryptionSdk_DecryptInput_encryptionContext_Validate() error {
	for key, value := range input.EncryptionContext {
		if !utf8.ValidString(key) {
			return fmt.Errorf("Invalid UTF bytes %s ", key)
		}
		if !utf8.ValidString(value) {
			return fmt.Errorf("Invalid UTF bytes %s ", value)
		}
	}

	return nil
}

type DecryptOutput struct {
	AlgorithmSuiteId awscryptographymaterialproviderssmithygeneratedtypes.ESDKAlgorithmSuiteId

	EncryptionContext map[string]string

	Plaintext []byte
}

func (input DecryptOutput) Validate() error {
	if input.EncryptionContext == nil {
		return fmt.Errorf("input.EncryptionContext is required but has a nil value.")
	}
	if input.Aws_cryptography_encryptionSdk_DecryptOutput_encryptionContext_Validate() != nil {
		return input.Aws_cryptography_encryptionSdk_DecryptOutput_encryptionContext_Validate()
	}

	return nil
}

func (input DecryptOutput) Aws_cryptography_encryptionSdk_DecryptOutput_encryptionContext_Validate() error {
	for key, value := range input.EncryptionContext {
		if !utf8.ValidString(key) {
			return fmt.Errorf("Invalid UTF bytes %s ", key)
		}
		if !utf8.ValidString(value) {
			return fmt.Errorf("Invalid UTF bytes %s ", value)
		}
	}

	return nil
}

type EncryptInput struct {
	Plaintext []byte

	AlgorithmSuiteId *awscryptographymaterialproviderssmithygeneratedtypes.ESDKAlgorithmSuiteId

	EncryptionContext map[string]string

	FrameLength *int64

	Keyring awscryptographymaterialproviderssmithygeneratedtypes.IKeyring

	MaterialsManager awscryptographymaterialproviderssmithygeneratedtypes.ICryptographicMaterialsManager
}

func (input EncryptInput) Validate() error {
	if input.Aws_cryptography_encryptionSdk_EncryptInput_encryptionContext_Validate() != nil {
		return input.Aws_cryptography_encryptionSdk_EncryptInput_encryptionContext_Validate()
	}
	if input.FrameLength != nil {
		if *input.FrameLength < 1 {
			return fmt.Errorf("FrameLength has a minimum of 1 but has the value of %d.", *input.FrameLength)
		}
		if *input.FrameLength > 4294967296 {
			return fmt.Errorf("FrameLength has a maximum of 4294967296 but has the value of %d.", *input.FrameLength)
		}
	}

	return nil
}

func (input EncryptInput) Aws_cryptography_encryptionSdk_EncryptInput_encryptionContext_Validate() error {
	for key, value := range input.EncryptionContext {
		if !utf8.ValidString(key) {
			return fmt.Errorf("Invalid UTF bytes %s ", key)
		}
		if !utf8.ValidString(value) {
			return fmt.Errorf("Invalid UTF bytes %s ", value)
		}
	}

	return nil
}

type EncryptOutput struct {
	AlgorithmSuiteId awscryptographymaterialproviderssmithygeneratedtypes.ESDKAlgorithmSuiteId

	Ciphertext []byte

	EncryptionContext map[string]string
}

func (input EncryptOutput) Validate() error {
	if input.EncryptionContext == nil {
		return fmt.Errorf("input.EncryptionContext is required but has a nil value.")
	}
	if input.Aws_cryptography_encryptionSdk_EncryptOutput_encryptionContext_Validate() != nil {
		return input.Aws_cryptography_encryptionSdk_EncryptOutput_encryptionContext_Validate()
	}

	return nil
}

func (input EncryptOutput) Aws_cryptography_encryptionSdk_EncryptOutput_encryptionContext_Validate() error {
	for key, value := range input.EncryptionContext {
		if !utf8.ValidString(key) {
			return fmt.Errorf("Invalid UTF bytes %s ", key)
		}
		if !utf8.ValidString(value) {
			return fmt.Errorf("Invalid UTF bytes %s ", value)
		}
	}

	return nil
}

type AtomicPrimitivesReference struct {
}

func (input AtomicPrimitivesReference) Validate() error {

	return nil
}

type AwsEncryptionSdkConfig struct {
	CommitmentPolicy *awscryptographymaterialproviderssmithygeneratedtypes.ESDKCommitmentPolicy

	MaxEncryptedDataKeys *int64

	NetV4_0_0_RetryPolicy *NetV4_0_0_RetryPolicy
}

func (input AwsEncryptionSdkConfig) Validate() error {
	if input.MaxEncryptedDataKeys != nil {
		if *input.MaxEncryptedDataKeys < 1 {
			return fmt.Errorf("CountingNumbers has a minimum of 1 but has the value of %d.", *input.MaxEncryptedDataKeys)
		}
	}

	return nil
}

type MaterialProvidersReference struct {
}

func (input MaterialProvidersReference) Validate() error {

	return nil
}

type AwsEncryptionSdkBaseException interface {
	// This is a dummy method to allow type assertion since Go empty interfaces
	// aren't useful for type assertion checks. No concrete class is expected to implement
	// this method. This is also not exported.
	interfaceBindingMethod()
}
