powerplant.go 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. // Code generated by go-swagger; DO NOT EDIT.
  2. package models
  3. // This file was generated by the swagger tool.
  4. // Editing this file might prove futile when you re-run the swagger generate command
  5. import (
  6. "context"
  7. "github.com/go-openapi/errors"
  8. "github.com/go-openapi/strfmt"
  9. "github.com/go-openapi/swag"
  10. "github.com/go-openapi/validate"
  11. )
  12. // Powerplant powerplant
  13. //
  14. // swagger:model powerplant
  15. type Powerplant struct {
  16. // efficiency
  17. // Required: true
  18. Efficiency *float64 `json:"efficiency"`
  19. // name
  20. // Required: true
  21. Name *string `json:"name"`
  22. // pmax
  23. // Required: true
  24. Pmax *float64 `json:"pmax"`
  25. // pmin
  26. // Required: true
  27. Pmin *float64 `json:"pmin"`
  28. // type
  29. // Required: true
  30. Type *string `json:"type"`
  31. }
  32. // Validate validates this powerplant
  33. func (m *Powerplant) Validate(formats strfmt.Registry) error {
  34. var res []error
  35. if err := m.validateEfficiency(formats); err != nil {
  36. res = append(res, err)
  37. }
  38. if err := m.validateName(formats); err != nil {
  39. res = append(res, err)
  40. }
  41. if err := m.validatePmax(formats); err != nil {
  42. res = append(res, err)
  43. }
  44. if err := m.validatePmin(formats); err != nil {
  45. res = append(res, err)
  46. }
  47. if err := m.validateType(formats); err != nil {
  48. res = append(res, err)
  49. }
  50. if len(res) > 0 {
  51. return errors.CompositeValidationError(res...)
  52. }
  53. return nil
  54. }
  55. func (m *Powerplant) validateEfficiency(formats strfmt.Registry) error {
  56. if err := validate.Required("efficiency", "body", m.Efficiency); err != nil {
  57. return err
  58. }
  59. return nil
  60. }
  61. func (m *Powerplant) validateName(formats strfmt.Registry) error {
  62. if err := validate.Required("name", "body", m.Name); err != nil {
  63. return err
  64. }
  65. return nil
  66. }
  67. func (m *Powerplant) validatePmax(formats strfmt.Registry) error {
  68. if err := validate.Required("pmax", "body", m.Pmax); err != nil {
  69. return err
  70. }
  71. return nil
  72. }
  73. func (m *Powerplant) validatePmin(formats strfmt.Registry) error {
  74. if err := validate.Required("pmin", "body", m.Pmin); err != nil {
  75. return err
  76. }
  77. return nil
  78. }
  79. func (m *Powerplant) validateType(formats strfmt.Registry) error {
  80. if err := validate.Required("type", "body", m.Type); err != nil {
  81. return err
  82. }
  83. return nil
  84. }
  85. // ContextValidate validates this powerplant based on context it is used
  86. func (m *Powerplant) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
  87. return nil
  88. }
  89. // MarshalBinary interface implementation
  90. func (m *Powerplant) MarshalBinary() ([]byte, error) {
  91. if m == nil {
  92. return nil, nil
  93. }
  94. return swag.WriteJSON(m)
  95. }
  96. // UnmarshalBinary interface implementation
  97. func (m *Powerplant) UnmarshalBinary(b []byte) error {
  98. var res Powerplant
  99. if err := swag.ReadJSON(b, &res); err != nil {
  100. return err
  101. }
  102. *m = res
  103. return nil
  104. }