go-kimai/models/customer_edit_form.go

165 lines
3.3 KiB
Go

// 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"
)
// CustomerEditForm customer edit form
//
// swagger:model CustomerEditForm
type CustomerEditForm struct {
// address
Address string `json:"address,omitempty"`
// billable
Billable bool `json:"billable,omitempty"`
// The hexadecimal color code (default: #d2d6de)
Color string `json:"color,omitempty"`
// comment
Comment string `json:"comment,omitempty"`
// company
Company string `json:"company,omitempty"`
// contact
Contact string `json:"contact,omitempty"`
// country
// Required: true
Country *string `json:"country"`
// currency
// Required: true
Currency *string `json:"currency"`
// email
Email string `json:"email,omitempty"`
// fax
Fax string `json:"fax,omitempty"`
// homepage
Homepage string `json:"homepage,omitempty"`
// mobile
Mobile string `json:"mobile,omitempty"`
// name
// Required: true
Name *string `json:"name"`
// number
Number string `json:"number,omitempty"`
// phone
Phone string `json:"phone,omitempty"`
// timezone
// Required: true
Timezone *string `json:"timezone"`
// vat Id
VatID string `json:"vatId,omitempty"`
// visible
Visible bool `json:"visible,omitempty"`
}
// Validate validates this customer edit form
func (m *CustomerEditForm) Validate(formats strfmt.Registry) error {
var res []error
if err := m.validateCountry(formats); err != nil {
res = append(res, err)
}
if err := m.validateCurrency(formats); err != nil {
res = append(res, err)
}
if err := m.validateName(formats); err != nil {
res = append(res, err)
}
if err := m.validateTimezone(formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *CustomerEditForm) validateCountry(formats strfmt.Registry) error {
if err := validate.Required("country", "body", m.Country); err != nil {
return err
}
return nil
}
func (m *CustomerEditForm) validateCurrency(formats strfmt.Registry) error {
if err := validate.Required("currency", "body", m.Currency); err != nil {
return err
}
return nil
}
func (m *CustomerEditForm) validateName(formats strfmt.Registry) error {
if err := validate.Required("name", "body", m.Name); err != nil {
return err
}
return nil
}
func (m *CustomerEditForm) validateTimezone(formats strfmt.Registry) error {
if err := validate.Required("timezone", "body", m.Timezone); err != nil {
return err
}
return nil
}
// ContextValidate validates this customer edit form based on context it is used
func (m *CustomerEditForm) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
return nil
}
// MarshalBinary interface implementation
func (m *CustomerEditForm) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *CustomerEditForm) UnmarshalBinary(b []byte) error {
var res CustomerEditForm
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}