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

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

// GetKillmailsKillmailIDKillmailHashOKBodyVictim get_killmails_killmail_id_killmail_hash_victim
//
// victim object
// swagger:model getKillmailsKillmailIdKillmailHashOKBodyVictim

type GetKillmailsKillmailIDKillmailHashOKBodyVictim struct {

	// get_killmails_killmail_id_killmail_hash_alliance_id
	//
	// alliance_id integer
	AllianceID int32 `json:"alliance_id,omitempty"`

	// get_killmails_killmail_id_killmail_hash_character_id
	//
	// character_id integer
	CharacterID int32 `json:"character_id,omitempty"`

	// get_killmails_killmail_id_killmail_hash_corporation_id
	//
	// corporation_id integer
	CorporationID int32 `json:"corporation_id,omitempty"`

	// get_killmails_killmail_id_killmail_hash_damage_taken
	//
	// How much total damage was taken by the victim
	//
	// Required: true
	DamageTaken *int32 `json:"damage_taken"`

	// get_killmails_killmail_id_killmail_hash_faction_id
	//
	// faction_id integer
	FactionID int32 `json:"faction_id,omitempty"`

	// items
	Items GetKillmailsKillmailIDKillmailHashOKBodyVictimItems `json:"items"`

	// position
	Position *GetKillmailsKillmailIDKillmailHashOKBodyVictimPosition `json:"position,omitempty"`

	// get_killmails_killmail_id_killmail_hash_ship_type_id
	//
	// The ship that the victim was piloting and was destroyed
	//
	// Required: true
	ShipTypeID *int32 `json:"ship_type_id"`
}

/* polymorph getKillmailsKillmailIdKillmailHashOKBodyVictim alliance_id false */

/* polymorph getKillmailsKillmailIdKillmailHashOKBodyVictim character_id false */

/* polymorph getKillmailsKillmailIdKillmailHashOKBodyVictim corporation_id false */

/* polymorph getKillmailsKillmailIdKillmailHashOKBodyVictim damage_taken false */

/* polymorph getKillmailsKillmailIdKillmailHashOKBodyVictim faction_id false */

/* polymorph getKillmailsKillmailIdKillmailHashOKBodyVictim items false */

/* polymorph getKillmailsKillmailIdKillmailHashOKBodyVictim position false */

/* polymorph getKillmailsKillmailIdKillmailHashOKBodyVictim ship_type_id false */

// Validate validates this get killmails killmail Id killmail hash o k body victim
func (m *GetKillmailsKillmailIDKillmailHashOKBodyVictim) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

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

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

func (m *GetKillmailsKillmailIDKillmailHashOKBodyVictim) validateDamageTaken(formats strfmt.Registry) error {

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

	return nil
}

func (m *GetKillmailsKillmailIDKillmailHashOKBodyVictim) validateItems(formats strfmt.Registry) error {

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

	return nil
}

func (m *GetKillmailsKillmailIDKillmailHashOKBodyVictim) validatePosition(formats strfmt.Registry) error {

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

	if m.Position != nil {

		if err := m.Position.Validate(formats); err != nil {
			if ve, ok := err.(*errors.Validation); ok {
				return ve.ValidateName("position")
			}
			return err
		}
	}

	return nil
}

func (m *GetKillmailsKillmailIDKillmailHashOKBodyVictim) validateShipTypeID(formats strfmt.Registry) error {

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

	return nil
}

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

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