// 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"
)

// GetWarsWarIDOKBodyDefender get_wars_war_id_defender
//
// The defending corporation or alliance that declared this war, only contains either corporation_id or alliance_id
// swagger:model getWarsWarIdOKBodyDefender

type GetWarsWarIDOKBodyDefender struct {

	// get_wars_war_id_alliance_id
	//
	// Alliance ID if and only if the defender is an alliance
	AllianceID int32 `json:"alliance_id,omitempty"`

	// get_wars_war_id_corporation_id
	//
	// Corporation ID if and only if the defender is a corporation
	CorporationID int32 `json:"corporation_id,omitempty"`

	// get_wars_war_id_isk_destroyed
	//
	// ISK value of ships the defender has killed
	// Required: true
	IskDestroyed *float32 `json:"isk_destroyed"`

	// get_wars_war_id_ships_killed
	//
	// The number of ships the defender has killed
	// Required: true
	ShipsKilled *int32 `json:"ships_killed"`
}

/* polymorph getWarsWarIdOKBodyDefender alliance_id false */

/* polymorph getWarsWarIdOKBodyDefender corporation_id false */

/* polymorph getWarsWarIdOKBodyDefender isk_destroyed false */

/* polymorph getWarsWarIdOKBodyDefender ships_killed false */

// Validate validates this get wars war Id o k body defender
func (m *GetWarsWarIDOKBodyDefender) Validate(formats strfmt.Registry) error {
	var res []error

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

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

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

func (m *GetWarsWarIDOKBodyDefender) validateIskDestroyed(formats strfmt.Registry) error {

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

	return nil
}

func (m *GetWarsWarIDOKBodyDefender) validateShipsKilled(formats strfmt.Registry) error {

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

	return nil
}

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

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