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

package ops

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

import (
	"context"

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

// TenantGetTenantResp tenant get tenant resp
//
// swagger:model tenant.GetTenantResp
type TenantGetTenantResp struct {

	// alias
	Alias string `json:"alias,omitempty"`

	// country
	Country string `json:"country,omitempty"`

	// created at
	CreatedAt string `json:"created_at,omitempty"`

	// customer id
	CustomerID string `json:"customer_id,omitempty"`

	// email
	Email string `json:"email,omitempty"`

	// id
	// Example: 0
	ID string `json:"id,omitempty"`

	// kind
	Kind EntityTenantKind `json:"kind,omitempty"`

	// name
	Name string `json:"name,omitempty"`

	// plan
	Plan EntityTenantPlan `json:"plan,omitempty"`

	// region
	Region EntityTenantRegion `json:"region,omitempty"`

	// sales owner email
	SalesOwnerEmail string `json:"sales_owner_email,omitempty"`

	// segmentation
	Segmentation EntityTenantSegmentation `json:"segmentation,omitempty"`

	// status
	Status EntityTenantStatus `json:"status,omitempty"`

	// time zone
	TimeZone string `json:"time_zone,omitempty"`
}

// Validate validates this tenant get tenant resp
func (m *TenantGetTenantResp) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

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

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

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

func (m *TenantGetTenantResp) validateKind(formats strfmt.Registry) error {
	if swag.IsZero(m.Kind) { // not required
		return nil
	}

	if err := m.Kind.Validate(formats); err != nil {
		if ve, ok := err.(*errors.Validation); ok {
			return ve.ValidateName("kind")
		} else if ce, ok := err.(*errors.CompositeError); ok {
			return ce.ValidateName("kind")
		}
		return err
	}

	return nil
}

func (m *TenantGetTenantResp) validatePlan(formats strfmt.Registry) error {
	if swag.IsZero(m.Plan) { // not required
		return nil
	}

	if err := m.Plan.Validate(formats); err != nil {
		if ve, ok := err.(*errors.Validation); ok {
			return ve.ValidateName("plan")
		} else if ce, ok := err.(*errors.CompositeError); ok {
			return ce.ValidateName("plan")
		}
		return err
	}

	return nil
}

func (m *TenantGetTenantResp) validateRegion(formats strfmt.Registry) error {
	if swag.IsZero(m.Region) { // not required
		return nil
	}

	if err := m.Region.Validate(formats); err != nil {
		if ve, ok := err.(*errors.Validation); ok {
			return ve.ValidateName("region")
		} else if ce, ok := err.(*errors.CompositeError); ok {
			return ce.ValidateName("region")
		}
		return err
	}

	return nil
}

func (m *TenantGetTenantResp) validateSegmentation(formats strfmt.Registry) error {
	if swag.IsZero(m.Segmentation) { // not required
		return nil
	}

	if err := m.Segmentation.Validate(formats); err != nil {
		if ve, ok := err.(*errors.Validation); ok {
			return ve.ValidateName("segmentation")
		} else if ce, ok := err.(*errors.CompositeError); ok {
			return ce.ValidateName("segmentation")
		}
		return err
	}

	return nil
}

func (m *TenantGetTenantResp) validateStatus(formats strfmt.Registry) error {
	if swag.IsZero(m.Status) { // not required
		return nil
	}

	if err := m.Status.Validate(formats); err != nil {
		if ve, ok := err.(*errors.Validation); ok {
			return ve.ValidateName("status")
		} else if ce, ok := err.(*errors.CompositeError); ok {
			return ce.ValidateName("status")
		}
		return err
	}

	return nil
}

// ContextValidate validate this tenant get tenant resp based on the context it is used
func (m *TenantGetTenantResp) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	var res []error

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

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

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

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

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

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

func (m *TenantGetTenantResp) contextValidateKind(ctx context.Context, formats strfmt.Registry) error {

	if swag.IsZero(m.Kind) { // not required
		return nil
	}

	if err := m.Kind.ContextValidate(ctx, formats); err != nil {
		if ve, ok := err.(*errors.Validation); ok {
			return ve.ValidateName("kind")
		} else if ce, ok := err.(*errors.CompositeError); ok {
			return ce.ValidateName("kind")
		}
		return err
	}

	return nil
}

func (m *TenantGetTenantResp) contextValidatePlan(ctx context.Context, formats strfmt.Registry) error {

	if swag.IsZero(m.Plan) { // not required
		return nil
	}

	if err := m.Plan.ContextValidate(ctx, formats); err != nil {
		if ve, ok := err.(*errors.Validation); ok {
			return ve.ValidateName("plan")
		} else if ce, ok := err.(*errors.CompositeError); ok {
			return ce.ValidateName("plan")
		}
		return err
	}

	return nil
}

func (m *TenantGetTenantResp) contextValidateRegion(ctx context.Context, formats strfmt.Registry) error {

	if swag.IsZero(m.Region) { // not required
		return nil
	}

	if err := m.Region.ContextValidate(ctx, formats); err != nil {
		if ve, ok := err.(*errors.Validation); ok {
			return ve.ValidateName("region")
		} else if ce, ok := err.(*errors.CompositeError); ok {
			return ce.ValidateName("region")
		}
		return err
	}

	return nil
}

func (m *TenantGetTenantResp) contextValidateSegmentation(ctx context.Context, formats strfmt.Registry) error {

	if swag.IsZero(m.Segmentation) { // not required
		return nil
	}

	if err := m.Segmentation.ContextValidate(ctx, formats); err != nil {
		if ve, ok := err.(*errors.Validation); ok {
			return ve.ValidateName("segmentation")
		} else if ce, ok := err.(*errors.CompositeError); ok {
			return ce.ValidateName("segmentation")
		}
		return err
	}

	return nil
}

func (m *TenantGetTenantResp) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error {

	if swag.IsZero(m.Status) { // not required
		return nil
	}

	if err := m.Status.ContextValidate(ctx, formats); err != nil {
		if ve, ok := err.(*errors.Validation); ok {
			return ve.ValidateName("status")
		} else if ce, ok := err.(*errors.CompositeError); ok {
			return ce.ValidateName("status")
		}
		return err
	}

	return nil
}

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

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