go-kimai/models/expense_edit_form.go

141 lines
3.0 KiB
Go
Raw Normal View History

2023-01-14 14:14:06 +00:00
// 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"
)
// ExpenseEditForm expense edit form
//
// swagger:model ExpenseEditForm
type ExpenseEditForm struct {
// Activity ID
Activity int64 `json:"activity,omitempty"`
// begin
// Example: 2023-01-14T05:12:43
// Required: true
// Format: date-time
Begin *strfmt.DateTime `json:"begin"`
// Customer ID
Customer int64 `json:"customer,omitempty"`
// description
Description string `json:"description,omitempty"`
// expense category
// Required: true
ExpenseCategory *string `json:"expenseCategory"`
// multiplier
// Required: true
Multiplier *float64 `json:"multiplier"`
// Project ID
// Required: true
Project *int64 `json:"project"`
// refundable
Refundable bool `json:"refundable,omitempty"`
}
// Validate validates this expense edit form
func (m *ExpenseEditForm) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateBegin(formats); err != nil {
res = append(res, err)
}
if err := m.validateExpenseCategory(formats); err != nil {
res = append(res, err)
}
if err := m.validateMultiplier(formats); err != nil {
res = append(res, err)
}
if err := m.validateProject(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *ExpenseEditForm) validateBegin(formats strfmt.Registry) error {
if err := validate.Required("begin", "body", m.Begin); err != nil {
return err
}
if err := validate.FormatOf("begin", "body", "date-time", m.Begin.String(), formats); err != nil {
return err
}
return nil
}
func (m *ExpenseEditForm) validateExpenseCategory(formats strfmt.Registry) error {
if err := validate.Required("expenseCategory", "body", m.ExpenseCategory); err != nil {
return err
}
return nil
}
func (m *ExpenseEditForm) validateMultiplier(formats strfmt.Registry) error {
if err := validate.Required("multiplier", "body", m.Multiplier); err != nil {
return err
}
return nil
}
func (m *ExpenseEditForm) validateProject(formats strfmt.Registry) error {
if err := validate.Required("project", "body", m.Project); err != nil {
return err
}
return nil
}
// ContextValidate validates this expense edit form based on context it is used
func (m *ExpenseEditForm) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *ExpenseEditForm) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ExpenseEditForm) UnmarshalBinary(b []byte) error {
var res ExpenseEditForm
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}