go-kimai/models/project_edit_form.go

173 lines
3.7 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"
)
// ProjectEditForm project edit form
//
// swagger:model ProjectEditForm
type ProjectEditForm struct {
// billable
Billable bool `json:"billable,omitempty"`
// The hexadecimal color code (default: #d2d6de)
Color string `json:"color,omitempty"`
// comment
Comment string `json:"comment,omitempty"`
// Customer ID
// Required: true
Customer *int64 `json:"customer"`
// end
// Example: 2023-01-14T05:12:43
// Format: date-time
End strfmt.DateTime `json:"end,omitempty"`
// global activities
GlobalActivities bool `json:"globalActivities,omitempty"`
// invoice text
InvoiceText string `json:"invoiceText,omitempty"`
// name
// Required: true
Name *string `json:"name"`
// order date
// Example: 2023-01-14T05:12:43
// Format: date-time
OrderDate strfmt.DateTime `json:"orderDate,omitempty"`
// order number
OrderNumber string `json:"orderNumber,omitempty"`
// start
// Example: 2023-01-14T05:12:43
// Format: date-time
Start strfmt.DateTime `json:"start,omitempty"`
// visible
Visible bool `json:"visible,omitempty"`
}
// Validate validates this project edit form
func (m *ProjectEditForm) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateCustomer(formats); err != nil {
res = append(res, err)
}
if err := m.validateEnd(formats); err != nil {
res = append(res, err)
}
if err := m.validateName(formats); err != nil {
res = append(res, err)
}
if err := m.validateOrderDate(formats); err != nil {
res = append(res, err)
}
if err := m.validateStart(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *ProjectEditForm) validateCustomer(formats strfmt.Registry) error {
if err := validate.Required("customer", "body", m.Customer); err != nil {
return err
}
return nil
}
func (m *ProjectEditForm) validateEnd(formats strfmt.Registry) error {
if swag.IsZero(m.End) { // not required
return nil
}
if err := validate.FormatOf("end", "body", "date-time", m.End.String(), formats); err != nil {
return err
}
return nil
}
func (m *ProjectEditForm) validateName(formats strfmt.Registry) error {
if err := validate.Required("name", "body", m.Name); err != nil {
return err
}
return nil
}
func (m *ProjectEditForm) validateOrderDate(formats strfmt.Registry) error {
if swag.IsZero(m.OrderDate) { // not required
return nil
}
if err := validate.FormatOf("orderDate", "body", "date-time", m.OrderDate.String(), formats); err != nil {
return err
}
return nil
}
func (m *ProjectEditForm) validateStart(formats strfmt.Registry) error {
if swag.IsZero(m.Start) { // not required
return nil
}
if err := validate.FormatOf("start", "body", "date-time", m.Start.String(), formats); err != nil {
return err
}
return nil
}
// ContextValidate validates this project edit form based on context it is used
func (m *ProjectEditForm) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *ProjectEditForm) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *ProjectEditForm) UnmarshalBinary(b []byte) error {
var res ProjectEditForm
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}