package runtime

import (
	
	
	
	

	
	
	
	
)

// String just returns the given string.
// It is just for compatibility to other types.
func ( string) (string, error) {
	return , nil
}

// StringSlice converts 'val' where individual strings are separated by
// 'sep' into a string slice.
func (,  string) ([]string, error) {
	return strings.Split(, ), nil
}

// Bool converts the given string representation of a boolean value into bool.
func ( string) (bool, error) {
	return strconv.ParseBool()
}

// BoolSlice converts 'val' where individual booleans are separated by
// 'sep' into a bool slice.
func (,  string) ([]bool, error) {
	 := strings.Split(, )
	 := make([]bool, len())
	for ,  := range  {
		,  := Bool()
		if  != nil {
			return nil, 
		}
		[] = 
	}
	return , nil
}

// Float64 converts the given string representation into representation of a floating point number into float64.
func ( string) (float64, error) {
	return strconv.ParseFloat(, 64)
}

// Float64Slice converts 'val' where individual floating point numbers are separated by
// 'sep' into a float64 slice.
func (,  string) ([]float64, error) {
	 := strings.Split(, )
	 := make([]float64, len())
	for ,  := range  {
		,  := Float64()
		if  != nil {
			return nil, 
		}
		[] = 
	}
	return , nil
}

// Float32 converts the given string representation of a floating point number into float32.
func ( string) (float32, error) {
	,  := strconv.ParseFloat(, 32)
	if  != nil {
		return 0, 
	}
	return float32(), nil
}

// Float32Slice converts 'val' where individual floating point numbers are separated by
// 'sep' into a float32 slice.
func (,  string) ([]float32, error) {
	 := strings.Split(, )
	 := make([]float32, len())
	for ,  := range  {
		,  := Float32()
		if  != nil {
			return nil, 
		}
		[] = 
	}
	return , nil
}

// Int64 converts the given string representation of an integer into int64.
func ( string) (int64, error) {
	return strconv.ParseInt(, 0, 64)
}

// Int64Slice converts 'val' where individual integers are separated by
// 'sep' into an int64 slice.
func (,  string) ([]int64, error) {
	 := strings.Split(, )
	 := make([]int64, len())
	for ,  := range  {
		,  := Int64()
		if  != nil {
			return nil, 
		}
		[] = 
	}
	return , nil
}

// Int32 converts the given string representation of an integer into int32.
func ( string) (int32, error) {
	,  := strconv.ParseInt(, 0, 32)
	if  != nil {
		return 0, 
	}
	return int32(), nil
}

// Int32Slice converts 'val' where individual integers are separated by
// 'sep' into an int32 slice.
func (,  string) ([]int32, error) {
	 := strings.Split(, )
	 := make([]int32, len())
	for ,  := range  {
		,  := Int32()
		if  != nil {
			return nil, 
		}
		[] = 
	}
	return , nil
}

// Uint64 converts the given string representation of an integer into uint64.
func ( string) (uint64, error) {
	return strconv.ParseUint(, 0, 64)
}

// Uint64Slice converts 'val' where individual integers are separated by
// 'sep' into a uint64 slice.
func (,  string) ([]uint64, error) {
	 := strings.Split(, )
	 := make([]uint64, len())
	for ,  := range  {
		,  := Uint64()
		if  != nil {
			return nil, 
		}
		[] = 
	}
	return , nil
}

// Uint32 converts the given string representation of an integer into uint32.
func ( string) (uint32, error) {
	,  := strconv.ParseUint(, 0, 32)
	if  != nil {
		return 0, 
	}
	return uint32(), nil
}

// Uint32Slice converts 'val' where individual integers are separated by
// 'sep' into a uint32 slice.
func (,  string) ([]uint32, error) {
	 := strings.Split(, )
	 := make([]uint32, len())
	for ,  := range  {
		,  := Uint32()
		if  != nil {
			return nil, 
		}
		[] = 
	}
	return , nil
}

// Bytes converts the given string representation of a byte sequence into a slice of bytes
// A bytes sequence is encoded in URL-safe base64 without padding
func ( string) ([]byte, error) {
	,  := base64.StdEncoding.DecodeString()
	if  != nil {
		,  = base64.URLEncoding.DecodeString()
		if  != nil {
			return nil, 
		}
	}
	return , nil
}

// BytesSlice converts 'val' where individual bytes sequences, encoded in URL-safe
// base64 without padding, are separated by 'sep' into a slice of byte slices.
func (,  string) ([][]byte, error) {
	 := strings.Split(, )
	 := make([][]byte, len())
	for ,  := range  {
		,  := Bytes()
		if  != nil {
			return nil, 
		}
		[] = 
	}
	return , nil
}

// Timestamp converts the given RFC3339 formatted string into a timestamp.Timestamp.
func ( string) (*timestamppb.Timestamp, error) {
	var  timestamppb.Timestamp
	 = strconv.Quote(strings.Trim(, `"`))
	 := &protojson.UnmarshalOptions{}
	if  := .Unmarshal([]byte(), &);  != nil {
		return nil, 
	}
	return &, nil
}

// Duration converts the given string into a timestamp.Duration.
func ( string) (*durationpb.Duration, error) {
	var  durationpb.Duration
	 = strconv.Quote(strings.Trim(, `"`))
	 := &protojson.UnmarshalOptions{}
	if  := .Unmarshal([]byte(), &);  != nil {
		return nil, 
	}
	return &, nil
}

// Enum converts the given string into an int32 that should be type casted into the
// correct enum proto type.
func ( string,  map[string]int32) (int32, error) {
	,  := []
	if  {
		return , nil
	}

	,  := Int32()
	if  != nil {
		return 0, fmt.Errorf("%s is not valid", )
	}
	for ,  := range  {
		if  ==  {
			return , nil
		}
	}
	return 0, fmt.Errorf("%s is not valid", )
}

// EnumSlice converts 'val' where individual enums are separated by 'sep'
// into a int32 slice. Each individual int32 should be type casted into the
// correct enum proto type.
func (,  string,  map[string]int32) ([]int32, error) {
	 := strings.Split(, )
	 := make([]int32, len())
	for ,  := range  {
		,  := Enum(, )
		if  != nil {
			return nil, 
		}
		[] = 
	}
	return , nil
}

// Support for google.protobuf.wrappers on top of primitive types

// StringValue well-known type support as wrapper around string type
func ( string) (*wrapperspb.StringValue, error) {
	return wrapperspb.String(), nil
}

// FloatValue well-known type support as wrapper around float32 type
func ( string) (*wrapperspb.FloatValue, error) {
	,  := Float32()
	return wrapperspb.Float(), 
}

// DoubleValue well-known type support as wrapper around float64 type
func ( string) (*wrapperspb.DoubleValue, error) {
	,  := Float64()
	return wrapperspb.Double(), 
}

// BoolValue well-known type support as wrapper around bool type
func ( string) (*wrapperspb.BoolValue, error) {
	,  := Bool()
	return wrapperspb.Bool(), 
}

// Int32Value well-known type support as wrapper around int32 type
func ( string) (*wrapperspb.Int32Value, error) {
	,  := Int32()
	return wrapperspb.Int32(), 
}

// UInt32Value well-known type support as wrapper around uint32 type
func ( string) (*wrapperspb.UInt32Value, error) {
	,  := Uint32()
	return wrapperspb.UInt32(), 
}

// Int64Value well-known type support as wrapper around int64 type
func ( string) (*wrapperspb.Int64Value, error) {
	,  := Int64()
	return wrapperspb.Int64(), 
}

// UInt64Value well-known type support as wrapper around uint64 type
func ( string) (*wrapperspb.UInt64Value, error) {
	,  := Uint64()
	return wrapperspb.UInt64(), 
}

// BytesValue well-known type support as wrapper around bytes[] type
func ( string) (*wrapperspb.BytesValue, error) {
	,  := Bytes()
	return wrapperspb.Bytes(), 
}