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

package model

// 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"
	"github.com/go-openapi/validate"
)

// CentralUserRole central user role
//
// swagger:model centralUserRole
type CentralUserRole struct {

	// real binding
	RealBinding bool `json:"real_binding,omitempty"`

	// role desc
	// Required: true
	RoleDesc *string `json:"role_desc"`

	// role display name
	// Required: true
	RoleDisplayName *string `json:"role_display_name"`

	// role id
	// Required: true
	RoleID *string `json:"role_id"`

	// role name
	// Required: true
	RoleName *string `json:"role_name"`

	// scope id
	// Required: true
	ScopeID *string `json:"scope_id"`

	// scope type
	// Required: true
	ScopeType *string `json:"scope_type"`

	// user id
	// Required: true
	UserID *string `json:"user_id"`
}

// Validate validates this central user role
func (m *CentralUserRole) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

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

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

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

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

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

func (m *CentralUserRole) validateRoleDesc(formats strfmt.Registry) error {

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

	return nil
}

func (m *CentralUserRole) validateRoleDisplayName(formats strfmt.Registry) error {

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

	return nil
}

func (m *CentralUserRole) validateRoleID(formats strfmt.Registry) error {

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

	return nil
}

func (m *CentralUserRole) validateRoleName(formats strfmt.Registry) error {

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

	return nil
}

func (m *CentralUserRole) validateScopeID(formats strfmt.Registry) error {

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

	return nil
}

func (m *CentralUserRole) validateScopeType(formats strfmt.Registry) error {

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

	return nil
}

func (m *CentralUserRole) validateUserID(formats strfmt.Registry) error {

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

	return nil
}

// ContextValidate validates this central user role based on context it is used
func (m *CentralUserRole) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
	return nil
}

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

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