| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- // 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 (
- "context"
- "github.com/go-openapi/errors"
- "github.com/go-openapi/strfmt"
- "github.com/go-openapi/swag"
- "github.com/go-openapi/validate"
- )
- // Payload payload
- //
- // swagger:model payload
- type Payload struct {
- // fuels
- // Required: true
- Fuels interface{} `json:"fuels"`
- // load
- // Required: true
- Load *float64 `json:"load"`
- // powerplants
- // Required: true
- Powerplants []interface{} `json:"powerplants"`
- }
- // Validate validates this payload
- func (m *Payload) Validate(formats strfmt.Registry) error {
- var res []error
- if err := m.validateFuels(formats); err != nil {
- res = append(res, err)
- }
- if err := m.validateLoad(formats); err != nil {
- res = append(res, err)
- }
- if err := m.validatePowerplants(formats); err != nil {
- res = append(res, err)
- }
- if len(res) > 0 {
- return errors.CompositeValidationError(res...)
- }
- return nil
- }
- func (m *Payload) validateFuels(formats strfmt.Registry) error {
- if m.Fuels == nil {
- return errors.Required("fuels", "body", nil)
- }
- return nil
- }
- func (m *Payload) validateLoad(formats strfmt.Registry) error {
- if err := validate.Required("load", "body", m.Load); err != nil {
- return err
- }
- return nil
- }
- func (m *Payload) validatePowerplants(formats strfmt.Registry) error {
- if err := validate.Required("powerplants", "body", m.Powerplants); err != nil {
- return err
- }
- return nil
- }
- // ContextValidate validates this payload based on context it is used
- func (m *Payload) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
- return nil
- }
- // MarshalBinary interface implementation
- func (m *Payload) MarshalBinary() ([]byte, error) {
- if m == nil {
- return nil, nil
- }
- return swag.WriteJSON(m)
- }
- // UnmarshalBinary interface implementation
- func (m *Payload) UnmarshalBinary(b []byte) error {
- var res Payload
- if err := swag.ReadJSON(b, &res); err != nil {
- return err
- }
- *m = res
- return nil
- }
|