// 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 (
	"encoding/json"

	strfmt "github.com/go-openapi/strfmt"

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

// PutFleetsFleetIDMembersMemberIDParamsBody put_fleets_fleet_id_members_member_id_movement
//
// movement object
// swagger:model putFleetsFleetIdMembersMemberIdParamsBody

type PutFleetsFleetIDMembersMemberIDParamsBody struct {

	// put_fleets_fleet_id_members_member_id_role
	//
	// - If a character is moved to the `fleet_commander` role, neither `wing_id` or `squad_id` should be specified - If a character is moved to the `wing_commander` role, only `wing_id` should be specified - If a character is moved to the `squad_commander` role, both `wing_id` and `squad_id` should be specified - If a character is moved to the `squad_member` role, both `wing_id` and `squad_id` should be specified
	//
	// Required: true
	Role *string `json:"role"`

	// put_fleets_fleet_id_members_member_id_squad_id
	//
	// squad_id integer
	// Minimum: 0
	SquadID *int64 `json:"squad_id,omitempty"`

	// put_fleets_fleet_id_members_member_id_wing_id
	//
	// wing_id integer
	// Minimum: 0
	WingID *int64 `json:"wing_id,omitempty"`
}

/* polymorph putFleetsFleetIdMembersMemberIdParamsBody role false */

/* polymorph putFleetsFleetIdMembersMemberIdParamsBody squad_id false */

/* polymorph putFleetsFleetIdMembersMemberIdParamsBody wing_id false */

// Validate validates this put fleets fleet Id members member Id params body
func (m *PutFleetsFleetIDMembersMemberIDParamsBody) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

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

var putFleetsFleetIdMembersMemberIdParamsBodyTypeRolePropEnum []interface{}

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

const (
	// PutFleetsFleetIDMembersMemberIDParamsBodyRoleFleetCommander captures enum value "fleet_commander"
	PutFleetsFleetIDMembersMemberIDParamsBodyRoleFleetCommander string = "fleet_commander"
	// PutFleetsFleetIDMembersMemberIDParamsBodyRoleWingCommander captures enum value "wing_commander"
	PutFleetsFleetIDMembersMemberIDParamsBodyRoleWingCommander string = "wing_commander"
	// PutFleetsFleetIDMembersMemberIDParamsBodyRoleSquadCommander captures enum value "squad_commander"
	PutFleetsFleetIDMembersMemberIDParamsBodyRoleSquadCommander string = "squad_commander"
	// PutFleetsFleetIDMembersMemberIDParamsBodyRoleSquadMember captures enum value "squad_member"
	PutFleetsFleetIDMembersMemberIDParamsBodyRoleSquadMember string = "squad_member"
)

// prop value enum
func (m *PutFleetsFleetIDMembersMemberIDParamsBody) validateRoleEnum(path, location string, value string) error {
	if err := validate.Enum(path, location, value, putFleetsFleetIdMembersMemberIdParamsBodyTypeRolePropEnum); err != nil {
		return err
	}
	return nil
}

func (m *PutFleetsFleetIDMembersMemberIDParamsBody) validateRole(formats strfmt.Registry) error {

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

	// value enum
	if err := m.validateRoleEnum("role", "body", *m.Role); err != nil {
		return err
	}

	return nil
}

func (m *PutFleetsFleetIDMembersMemberIDParamsBody) validateSquadID(formats strfmt.Registry) error {

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

	if err := validate.MinimumInt("squad_id", "body", int64(*m.SquadID), 0, false); err != nil {
		return err
	}

	return nil
}

func (m *PutFleetsFleetIDMembersMemberIDParamsBody) validateWingID(formats strfmt.Registry) error {

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

	if err := validate.MinimumInt("wing_id", "body", int64(*m.WingID), 0, false); err != nil {
		return err
	}

	return nil
}

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

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