// 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"
)

// FencingCredentialsParams fencing credentials params
//
// swagger:model fencing-credentials-params
type FencingCredentialsParams struct {

	// The URL of the host's BMC, for example https://bmc1.example.com.
	// Required: true
	Address *string `json:"address"`

	// Whether to enable or disable certificate verification when connecting to the host's BMC.
	// Enum: [Enabled Disabled]
	CertificateVerification *string `json:"certificate_verification,omitempty"`

	// The password to connect to the host's BMC.
	// Required: true
	Password *string `json:"password"`

	// The username to connect to the host's BMC.
	// Required: true
	Username *string `json:"username"`
}

// Validate validates this fencing credentials params
func (m *FencingCredentialsParams) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

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

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

func (m *FencingCredentialsParams) validateAddress(formats strfmt.Registry) error {

	if err := validate.Required("address", "body", m.Address); err != nil {
		return err
	}

	return nil
}

var fencingCredentialsParamsTypeCertificateVerificationPropEnum []interface{}

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

const (

	// FencingCredentialsParamsCertificateVerificationEnabled captures enum value "Enabled"
	FencingCredentialsParamsCertificateVerificationEnabled string = "Enabled"

	// FencingCredentialsParamsCertificateVerificationDisabled captures enum value "Disabled"
	FencingCredentialsParamsCertificateVerificationDisabled string = "Disabled"
)

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

func (m *FencingCredentialsParams) validateCertificateVerification(formats strfmt.Registry) error {
	if swag.IsZero(m.CertificateVerification) { // not required
		return nil
	}

	// value enum
	if err := m.validateCertificateVerificationEnum("certificate_verification", "body", *m.CertificateVerification); err != nil {
		return err
	}

	return nil
}

func (m *FencingCredentialsParams) validatePassword(formats strfmt.Registry) error {

	if err := validate.Required("password", "body", m.Password); err != nil {
		return err
	}

	return nil
}

func (m *FencingCredentialsParams) validateUsername(formats strfmt.Registry) error {

	if err := validate.Required("username", "body", m.Username); err != nil {
		return err
	}

	return nil
}

// ContextValidate validates this fencing credentials params based on context it is used
func (m *FencingCredentialsParams) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

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

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