/
transaction_location_type_model.go
127 lines (97 loc) · 3.43 KB
/
transaction_location_type_model.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// 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"
)
// TransactionLocationTypeModel Information about a location type
// Example: {"documentAddressId":789,"documentId":456,"documentLocationTypeId":123,"locationTypeCode":"SingleLocation"}
//
// swagger:model TransactionLocationTypeModel
type TransactionLocationTypeModel struct {
// Address ID for the transaction
// Example: 789
// Read Only: true
DocumentAddressID int64 `json:"documentAddressId,omitempty"`
// Transaction ID
// Example: 456
// Read Only: true
DocumentID int64 `json:"documentId,omitempty"`
// Location type ID for this location type in transaction
// Example: 123
// Read Only: true
DocumentLocationTypeID int64 `json:"documentLocationTypeId,omitempty"`
// Location type code
// Example: SingleLocation
// Read Only: true
LocationTypeCode string `json:"locationTypeCode,omitempty"`
}
// Validate validates this transaction location type model
func (m *TransactionLocationTypeModel) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validate this transaction location type model based on the context it is used
func (m *TransactionLocationTypeModel) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateDocumentAddressID(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateDocumentID(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateDocumentLocationTypeID(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateLocationTypeCode(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *TransactionLocationTypeModel) contextValidateDocumentAddressID(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "documentAddressId", "body", int64(m.DocumentAddressID)); err != nil {
return err
}
return nil
}
func (m *TransactionLocationTypeModel) contextValidateDocumentID(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "documentId", "body", int64(m.DocumentID)); err != nil {
return err
}
return nil
}
func (m *TransactionLocationTypeModel) contextValidateDocumentLocationTypeID(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "documentLocationTypeId", "body", int64(m.DocumentLocationTypeID)); err != nil {
return err
}
return nil
}
func (m *TransactionLocationTypeModel) contextValidateLocationTypeCode(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "locationTypeCode", "body", string(m.LocationTypeCode)); err != nil {
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *TransactionLocationTypeModel) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *TransactionLocationTypeModel) UnmarshalBinary(b []byte) error {
var res TransactionLocationTypeModel
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}