// Code generated by mdatagen. DO NOT EDIT.

package configcompression

import (
	"errors"
	"slices"
)

type CompressionParams struct {
	Level Level `mapstructure:"level,omitempty"`

	// prevent unkeyed literal initialization
	_ struct{}
}

type Level int

// Type type represents a compression method
type Type string

// Validate validates the Type fields according to schema annotations.
// Called by confmap on config resolution. Don't call it explicitly to avoid duplicate errors.
func (c Type) Validate() error {
	var err error

	if !slices.Contains([]string{"gzip", "zlib", "deflate", "snappy", "x-snappy-framed", "zstd", "lz4", "none", ""}, string(c)) {
		err = errors.Join(err, errors.New("type must be one of [gzip, zlib, deflate, snappy, x-snappy-framed, zstd, lz4, none]"))
	}

	return err
}
