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

// CentralRegistrationReq central registration req
//
// swagger:model centralRegistrationReq
type CentralRegistrationReq struct {

	// accept service
	// Required: true
	AcceptService bool `json:"accept_service"`

	// company
	// Required: true
	Company *string `json:"company"`

	// country
	// Required: true
	Country *string `json:"country"`

	// email
	// Required: true
	Email *string `json:"email"`

	// first name
	// Required: true
	FirstName *string `json:"first_name"`

	// job
	// Required: true
	Job *string `json:"job"`

	// last name
	// Required: true
	LastName *string `json:"last_name"`

	// password
	// Required: true
	Password *string `json:"password"`

	// phone number
	// Required: true
	PhoneNumber *string `json:"phone_number"`

	// recaptcha response
	// Required: true
	RecaptchaResponse *string `json:"recaptcha_response"`

	// third party account provider
	ThirdPartyAccountProvider string `json:"third_party_account_provider,omitempty"`

	// third party account token
	ThirdPartyAccountToken string `json:"third_party_account_token,omitempty"`
}

// Validate validates this central registration req
func (m *CentralRegistrationReq) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

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

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

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

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

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

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

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

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

func (m *CentralRegistrationReq) validateAcceptService(formats strfmt.Registry) error {

	if err := validate.Required("accept_service", "body", bool(m.AcceptService)); err != nil {
		return err
	}

	return nil
}

func (m *CentralRegistrationReq) validateCompany(formats strfmt.Registry) error {

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

	return nil
}

func (m *CentralRegistrationReq) validateCountry(formats strfmt.Registry) error {

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

	return nil
}

func (m *CentralRegistrationReq) validateEmail(formats strfmt.Registry) error {

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

	return nil
}

func (m *CentralRegistrationReq) validateFirstName(formats strfmt.Registry) error {

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

	return nil
}

func (m *CentralRegistrationReq) validateJob(formats strfmt.Registry) error {

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

	return nil
}

func (m *CentralRegistrationReq) validateLastName(formats strfmt.Registry) error {

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

	return nil
}

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

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

	return nil
}

func (m *CentralRegistrationReq) validatePhoneNumber(formats strfmt.Registry) error {

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

	return nil
}

func (m *CentralRegistrationReq) validateRecaptchaResponse(formats strfmt.Registry) error {

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

	return nil
}

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

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