// Code generated by go-swagger; DO NOT EDIT.

package models

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"context"
	"encoding/json"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/strfmt"
	"github.com/go-openapi/swag"
	"github.com/go-openapi/validate"
)

// RawAttributes raw attributes
//
// swagger:model RawAttributes
type RawAttributes struct {

	// Content Disposition
	// Example: ATTACHMENT
	// Enum: [INLINE ATTACHMENT]
	ContentDisposition string `json:"contentDisposition,omitempty"`
}

// Validate validates this raw attributes
func (m *RawAttributes) Validate(formats strfmt.Registry) error {
	var res []error

	if err := m.validateContentDisposition(formats); err != nil {
		res = append(res, err)
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}

var rawAttributesTypeContentDispositionPropEnum []interface{}

func init() {
	var res []string
	if err := json.Unmarshal([]byte(`["INLINE","ATTACHMENT"]`), &res); err != nil {
		panic(err)
	}
	for _, v := range res {
		rawAttributesTypeContentDispositionPropEnum = append(rawAttributesTypeContentDispositionPropEnum, v)
	}
}

const (

	// RawAttributesContentDispositionINLINE captures enum value "INLINE"
	RawAttributesContentDispositionINLINE string = "INLINE"

	// RawAttributesContentDispositionATTACHMENT captures enum value "ATTACHMENT"
	RawAttributesContentDispositionATTACHMENT string = "ATTACHMENT"
)

// prop value enum
func (m *RawAttributes) validateContentDispositionEnum(path, location string, value string) error {
	if err := validate.EnumCase(path, location, value, rawAttributesTypeContentDispositionPropEnum, true); err != nil {
		return err
	}
	return nil
}

func (m *RawAttributes) validateContentDisposition(formats strfmt.Registry) error {
	if swag.IsZero(m.ContentDisposition) { // not required
		return nil
	}

	// value enum
	if err := m.validateContentDispositionEnum("contentDisposition", "body", m.ContentDisposition); err != nil {
		return err
	}

	return nil
}

// ContextValidate validates this raw attributes based on context it is used
func (m *RawAttributes) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

// MarshalBinary interface implementation
func (m *RawAttributes) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}

// UnmarshalBinary interface implementation
func (m *RawAttributes) UnmarshalBinary(b []byte) error {
	var res RawAttributes
	if err := swag.ReadJSON(b, &res); err != nil {
		return err
	}
	*m = res
	return nil
}
