github.com/digitalocean/go-netbox@v0.0.2/netbox/models/custom_field.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  // Copyright 2020 The go-netbox Authors.
     4  //
     5  // Licensed under the Apache License, Version 2.0 (the "License");
     6  // you may not use this file except in compliance with the License.
     7  // You may obtain a copy of the License at
     8  //
     9  //   http://www.apache.org/licenses/LICENSE-2.0
    10  //
    11  // Unless required by applicable law or agreed to in writing, software
    12  // distributed under the License is distributed on an "AS IS" BASIS,
    13  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  // See the License for the specific language governing permissions and
    15  // limitations under the License.
    16  //
    17  
    18  package models
    19  
    20  // This file was generated by the swagger tool.
    21  // Editing this file might prove futile when you re-run the swagger generate command
    22  
    23  import (
    24  	"context"
    25  	"encoding/json"
    26  	"strconv"
    27  
    28  	"github.com/go-openapi/errors"
    29  	"github.com/go-openapi/strfmt"
    30  	"github.com/go-openapi/swag"
    31  	"github.com/go-openapi/validate"
    32  )
    33  
    34  // CustomField custom field
    35  //
    36  // swagger:model CustomField
    37  type CustomField struct {
    38  
    39  	// Comma-separated list of available choices (for selection fields)
    40  	Choices []string `json:"choices"`
    41  
    42  	// content types
    43  	// Required: true
    44  	// Unique: true
    45  	ContentTypes []string `json:"content_types"`
    46  
    47  	// Default
    48  	//
    49  	// Default value for the field (must be a JSON value). Encapsulate strings with double quotes (e.g. "Foo").
    50  	Default *string `json:"default,omitempty"`
    51  
    52  	// Description
    53  	// Max Length: 200
    54  	Description string `json:"description,omitempty"`
    55  
    56  	// Display
    57  	// Read Only: true
    58  	Display string `json:"display,omitempty"`
    59  
    60  	// filter logic
    61  	FilterLogic *CustomFieldFilterLogic `json:"filter_logic,omitempty"`
    62  
    63  	// Id
    64  	// Read Only: true
    65  	ID int64 `json:"id,omitempty"`
    66  
    67  	// Label
    68  	//
    69  	// Name of the field as displayed to users (if not provided, the field's name will be used)
    70  	// Max Length: 50
    71  	Label string `json:"label,omitempty"`
    72  
    73  	// Name
    74  	//
    75  	// Internal field name
    76  	// Required: true
    77  	// Max Length: 50
    78  	// Min Length: 1
    79  	Name *string `json:"name"`
    80  
    81  	// Required
    82  	//
    83  	// If true, this field is required when creating new objects or editing an existing object.
    84  	Required bool `json:"required,omitempty"`
    85  
    86  	// type
    87  	// Required: true
    88  	Type *CustomFieldType `json:"type"`
    89  
    90  	// Url
    91  	// Read Only: true
    92  	// Format: uri
    93  	URL strfmt.URI `json:"url,omitempty"`
    94  
    95  	// Maximum value
    96  	//
    97  	// Maximum allowed value (for numeric fields)
    98  	// Maximum: 2.147483647e+09
    99  	// Minimum: 0
   100  	ValidationMaximum *int64 `json:"validation_maximum,omitempty"`
   101  
   102  	// Minimum value
   103  	//
   104  	// Minimum allowed value (for numeric fields)
   105  	// Maximum: 2.147483647e+09
   106  	// Minimum: 0
   107  	ValidationMinimum *int64 `json:"validation_minimum,omitempty"`
   108  
   109  	// Validation regex
   110  	//
   111  	// Regular expression to enforce on text field values. Use ^ and $ to force matching of entire string. For example, <code>^[A-Z]{3}$</code> will limit values to exactly three uppercase letters.
   112  	// Max Length: 500
   113  	ValidationRegex string `json:"validation_regex,omitempty"`
   114  
   115  	// Weight
   116  	//
   117  	// Fields with higher weights appear lower in a form.
   118  	// Maximum: 32767
   119  	// Minimum: 0
   120  	Weight *int64 `json:"weight,omitempty"`
   121  }
   122  
   123  // Validate validates this custom field
   124  func (m *CustomField) Validate(formats strfmt.Registry) error {
   125  	var res []error
   126  
   127  	if err := m.validateChoices(formats); err != nil {
   128  		res = append(res, err)
   129  	}
   130  
   131  	if err := m.validateContentTypes(formats); err != nil {
   132  		res = append(res, err)
   133  	}
   134  
   135  	if err := m.validateDescription(formats); err != nil {
   136  		res = append(res, err)
   137  	}
   138  
   139  	if err := m.validateFilterLogic(formats); err != nil {
   140  		res = append(res, err)
   141  	}
   142  
   143  	if err := m.validateLabel(formats); err != nil {
   144  		res = append(res, err)
   145  	}
   146  
   147  	if err := m.validateName(formats); err != nil {
   148  		res = append(res, err)
   149  	}
   150  
   151  	if err := m.validateType(formats); err != nil {
   152  		res = append(res, err)
   153  	}
   154  
   155  	if err := m.validateURL(formats); err != nil {
   156  		res = append(res, err)
   157  	}
   158  
   159  	if err := m.validateValidationMaximum(formats); err != nil {
   160  		res = append(res, err)
   161  	}
   162  
   163  	if err := m.validateValidationMinimum(formats); err != nil {
   164  		res = append(res, err)
   165  	}
   166  
   167  	if err := m.validateValidationRegex(formats); err != nil {
   168  		res = append(res, err)
   169  	}
   170  
   171  	if err := m.validateWeight(formats); err != nil {
   172  		res = append(res, err)
   173  	}
   174  
   175  	if len(res) > 0 {
   176  		return errors.CompositeValidationError(res...)
   177  	}
   178  	return nil
   179  }
   180  
   181  func (m *CustomField) validateChoices(formats strfmt.Registry) error {
   182  	if swag.IsZero(m.Choices) { // not required
   183  		return nil
   184  	}
   185  
   186  	for i := 0; i < len(m.Choices); i++ {
   187  
   188  		if err := validate.MinLength("choices"+"."+strconv.Itoa(i), "body", m.Choices[i], 1); err != nil {
   189  			return err
   190  		}
   191  
   192  		if err := validate.MaxLength("choices"+"."+strconv.Itoa(i), "body", m.Choices[i], 100); err != nil {
   193  			return err
   194  		}
   195  
   196  	}
   197  
   198  	return nil
   199  }
   200  
   201  func (m *CustomField) validateContentTypes(formats strfmt.Registry) error {
   202  
   203  	if err := validate.Required("content_types", "body", m.ContentTypes); err != nil {
   204  		return err
   205  	}
   206  
   207  	if err := validate.UniqueItems("content_types", "body", m.ContentTypes); err != nil {
   208  		return err
   209  	}
   210  
   211  	return nil
   212  }
   213  
   214  func (m *CustomField) validateDescription(formats strfmt.Registry) error {
   215  	if swag.IsZero(m.Description) { // not required
   216  		return nil
   217  	}
   218  
   219  	if err := validate.MaxLength("description", "body", m.Description, 200); err != nil {
   220  		return err
   221  	}
   222  
   223  	return nil
   224  }
   225  
   226  func (m *CustomField) validateFilterLogic(formats strfmt.Registry) error {
   227  	if swag.IsZero(m.FilterLogic) { // not required
   228  		return nil
   229  	}
   230  
   231  	if m.FilterLogic != nil {
   232  		if err := m.FilterLogic.Validate(formats); err != nil {
   233  			if ve, ok := err.(*errors.Validation); ok {
   234  				return ve.ValidateName("filter_logic")
   235  			} else if ce, ok := err.(*errors.CompositeError); ok {
   236  				return ce.ValidateName("filter_logic")
   237  			}
   238  			return err
   239  		}
   240  	}
   241  
   242  	return nil
   243  }
   244  
   245  func (m *CustomField) validateLabel(formats strfmt.Registry) error {
   246  	if swag.IsZero(m.Label) { // not required
   247  		return nil
   248  	}
   249  
   250  	if err := validate.MaxLength("label", "body", m.Label, 50); err != nil {
   251  		return err
   252  	}
   253  
   254  	return nil
   255  }
   256  
   257  func (m *CustomField) validateName(formats strfmt.Registry) error {
   258  
   259  	if err := validate.Required("name", "body", m.Name); err != nil {
   260  		return err
   261  	}
   262  
   263  	if err := validate.MinLength("name", "body", *m.Name, 1); err != nil {
   264  		return err
   265  	}
   266  
   267  	if err := validate.MaxLength("name", "body", *m.Name, 50); err != nil {
   268  		return err
   269  	}
   270  
   271  	return nil
   272  }
   273  
   274  func (m *CustomField) validateType(formats strfmt.Registry) error {
   275  
   276  	if err := validate.Required("type", "body", m.Type); err != nil {
   277  		return err
   278  	}
   279  
   280  	if m.Type != nil {
   281  		if err := m.Type.Validate(formats); err != nil {
   282  			if ve, ok := err.(*errors.Validation); ok {
   283  				return ve.ValidateName("type")
   284  			} else if ce, ok := err.(*errors.CompositeError); ok {
   285  				return ce.ValidateName("type")
   286  			}
   287  			return err
   288  		}
   289  	}
   290  
   291  	return nil
   292  }
   293  
   294  func (m *CustomField) validateURL(formats strfmt.Registry) error {
   295  	if swag.IsZero(m.URL) { // not required
   296  		return nil
   297  	}
   298  
   299  	if err := validate.FormatOf("url", "body", "uri", m.URL.String(), formats); err != nil {
   300  		return err
   301  	}
   302  
   303  	return nil
   304  }
   305  
   306  func (m *CustomField) validateValidationMaximum(formats strfmt.Registry) error {
   307  	if swag.IsZero(m.ValidationMaximum) { // not required
   308  		return nil
   309  	}
   310  
   311  	if err := validate.MinimumInt("validation_maximum", "body", *m.ValidationMaximum, 0, false); err != nil {
   312  		return err
   313  	}
   314  
   315  	if err := validate.MaximumInt("validation_maximum", "body", *m.ValidationMaximum, 2.147483647e+09, false); err != nil {
   316  		return err
   317  	}
   318  
   319  	return nil
   320  }
   321  
   322  func (m *CustomField) validateValidationMinimum(formats strfmt.Registry) error {
   323  	if swag.IsZero(m.ValidationMinimum) { // not required
   324  		return nil
   325  	}
   326  
   327  	if err := validate.MinimumInt("validation_minimum", "body", *m.ValidationMinimum, 0, false); err != nil {
   328  		return err
   329  	}
   330  
   331  	if err := validate.MaximumInt("validation_minimum", "body", *m.ValidationMinimum, 2.147483647e+09, false); err != nil {
   332  		return err
   333  	}
   334  
   335  	return nil
   336  }
   337  
   338  func (m *CustomField) validateValidationRegex(formats strfmt.Registry) error {
   339  	if swag.IsZero(m.ValidationRegex) { // not required
   340  		return nil
   341  	}
   342  
   343  	if err := validate.MaxLength("validation_regex", "body", m.ValidationRegex, 500); err != nil {
   344  		return err
   345  	}
   346  
   347  	return nil
   348  }
   349  
   350  func (m *CustomField) validateWeight(formats strfmt.Registry) error {
   351  	if swag.IsZero(m.Weight) { // not required
   352  		return nil
   353  	}
   354  
   355  	if err := validate.MinimumInt("weight", "body", *m.Weight, 0, false); err != nil {
   356  		return err
   357  	}
   358  
   359  	if err := validate.MaximumInt("weight", "body", *m.Weight, 32767, false); err != nil {
   360  		return err
   361  	}
   362  
   363  	return nil
   364  }
   365  
   366  // ContextValidate validate this custom field based on the context it is used
   367  func (m *CustomField) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   368  	var res []error
   369  
   370  	if err := m.contextValidateDisplay(ctx, formats); err != nil {
   371  		res = append(res, err)
   372  	}
   373  
   374  	if err := m.contextValidateFilterLogic(ctx, formats); err != nil {
   375  		res = append(res, err)
   376  	}
   377  
   378  	if err := m.contextValidateID(ctx, formats); err != nil {
   379  		res = append(res, err)
   380  	}
   381  
   382  	if err := m.contextValidateType(ctx, formats); err != nil {
   383  		res = append(res, err)
   384  	}
   385  
   386  	if err := m.contextValidateURL(ctx, formats); err != nil {
   387  		res = append(res, err)
   388  	}
   389  
   390  	if len(res) > 0 {
   391  		return errors.CompositeValidationError(res...)
   392  	}
   393  	return nil
   394  }
   395  
   396  func (m *CustomField) contextValidateDisplay(ctx context.Context, formats strfmt.Registry) error {
   397  
   398  	if err := validate.ReadOnly(ctx, "display", "body", string(m.Display)); err != nil {
   399  		return err
   400  	}
   401  
   402  	return nil
   403  }
   404  
   405  func (m *CustomField) contextValidateFilterLogic(ctx context.Context, formats strfmt.Registry) error {
   406  
   407  	if m.FilterLogic != nil {
   408  		if err := m.FilterLogic.ContextValidate(ctx, formats); err != nil {
   409  			if ve, ok := err.(*errors.Validation); ok {
   410  				return ve.ValidateName("filter_logic")
   411  			} else if ce, ok := err.(*errors.CompositeError); ok {
   412  				return ce.ValidateName("filter_logic")
   413  			}
   414  			return err
   415  		}
   416  	}
   417  
   418  	return nil
   419  }
   420  
   421  func (m *CustomField) contextValidateID(ctx context.Context, formats strfmt.Registry) error {
   422  
   423  	if err := validate.ReadOnly(ctx, "id", "body", int64(m.ID)); err != nil {
   424  		return err
   425  	}
   426  
   427  	return nil
   428  }
   429  
   430  func (m *CustomField) contextValidateType(ctx context.Context, formats strfmt.Registry) error {
   431  
   432  	if m.Type != nil {
   433  		if err := m.Type.ContextValidate(ctx, formats); err != nil {
   434  			if ve, ok := err.(*errors.Validation); ok {
   435  				return ve.ValidateName("type")
   436  			} else if ce, ok := err.(*errors.CompositeError); ok {
   437  				return ce.ValidateName("type")
   438  			}
   439  			return err
   440  		}
   441  	}
   442  
   443  	return nil
   444  }
   445  
   446  func (m *CustomField) contextValidateURL(ctx context.Context, formats strfmt.Registry) error {
   447  
   448  	if err := validate.ReadOnly(ctx, "url", "body", strfmt.URI(m.URL)); err != nil {
   449  		return err
   450  	}
   451  
   452  	return nil
   453  }
   454  
   455  // MarshalBinary interface implementation
   456  func (m *CustomField) MarshalBinary() ([]byte, error) {
   457  	if m == nil {
   458  		return nil, nil
   459  	}
   460  	return swag.WriteJSON(m)
   461  }
   462  
   463  // UnmarshalBinary interface implementation
   464  func (m *CustomField) UnmarshalBinary(b []byte) error {
   465  	var res CustomField
   466  	if err := swag.ReadJSON(b, &res); err != nil {
   467  		return err
   468  	}
   469  	*m = res
   470  	return nil
   471  }
   472  
   473  // CustomFieldFilterLogic Filter logic
   474  //
   475  // swagger:model CustomFieldFilterLogic
   476  type CustomFieldFilterLogic struct {
   477  
   478  	// label
   479  	// Required: true
   480  	// Enum: [Disabled Loose Exact]
   481  	Label *string `json:"label"`
   482  
   483  	// value
   484  	// Required: true
   485  	// Enum: [disabled loose exact]
   486  	Value *string `json:"value"`
   487  }
   488  
   489  // Validate validates this custom field filter logic
   490  func (m *CustomFieldFilterLogic) Validate(formats strfmt.Registry) error {
   491  	var res []error
   492  
   493  	if err := m.validateLabel(formats); err != nil {
   494  		res = append(res, err)
   495  	}
   496  
   497  	if err := m.validateValue(formats); err != nil {
   498  		res = append(res, err)
   499  	}
   500  
   501  	if len(res) > 0 {
   502  		return errors.CompositeValidationError(res...)
   503  	}
   504  	return nil
   505  }
   506  
   507  var customFieldFilterLogicTypeLabelPropEnum []interface{}
   508  
   509  func init() {
   510  	var res []string
   511  	if err := json.Unmarshal([]byte(`["Disabled","Loose","Exact"]`), &res); err != nil {
   512  		panic(err)
   513  	}
   514  	for _, v := range res {
   515  		customFieldFilterLogicTypeLabelPropEnum = append(customFieldFilterLogicTypeLabelPropEnum, v)
   516  	}
   517  }
   518  
   519  const (
   520  
   521  	// CustomFieldFilterLogicLabelDisabled captures enum value "Disabled"
   522  	CustomFieldFilterLogicLabelDisabled string = "Disabled"
   523  
   524  	// CustomFieldFilterLogicLabelLoose captures enum value "Loose"
   525  	CustomFieldFilterLogicLabelLoose string = "Loose"
   526  
   527  	// CustomFieldFilterLogicLabelExact captures enum value "Exact"
   528  	CustomFieldFilterLogicLabelExact string = "Exact"
   529  )
   530  
   531  // prop value enum
   532  func (m *CustomFieldFilterLogic) validateLabelEnum(path, location string, value string) error {
   533  	if err := validate.EnumCase(path, location, value, customFieldFilterLogicTypeLabelPropEnum, true); err != nil {
   534  		return err
   535  	}
   536  	return nil
   537  }
   538  
   539  func (m *CustomFieldFilterLogic) validateLabel(formats strfmt.Registry) error {
   540  
   541  	if err := validate.Required("filter_logic"+"."+"label", "body", m.Label); err != nil {
   542  		return err
   543  	}
   544  
   545  	// value enum
   546  	if err := m.validateLabelEnum("filter_logic"+"."+"label", "body", *m.Label); err != nil {
   547  		return err
   548  	}
   549  
   550  	return nil
   551  }
   552  
   553  var customFieldFilterLogicTypeValuePropEnum []interface{}
   554  
   555  func init() {
   556  	var res []string
   557  	if err := json.Unmarshal([]byte(`["disabled","loose","exact"]`), &res); err != nil {
   558  		panic(err)
   559  	}
   560  	for _, v := range res {
   561  		customFieldFilterLogicTypeValuePropEnum = append(customFieldFilterLogicTypeValuePropEnum, v)
   562  	}
   563  }
   564  
   565  const (
   566  
   567  	// CustomFieldFilterLogicValueDisabled captures enum value "disabled"
   568  	CustomFieldFilterLogicValueDisabled string = "disabled"
   569  
   570  	// CustomFieldFilterLogicValueLoose captures enum value "loose"
   571  	CustomFieldFilterLogicValueLoose string = "loose"
   572  
   573  	// CustomFieldFilterLogicValueExact captures enum value "exact"
   574  	CustomFieldFilterLogicValueExact string = "exact"
   575  )
   576  
   577  // prop value enum
   578  func (m *CustomFieldFilterLogic) validateValueEnum(path, location string, value string) error {
   579  	if err := validate.EnumCase(path, location, value, customFieldFilterLogicTypeValuePropEnum, true); err != nil {
   580  		return err
   581  	}
   582  	return nil
   583  }
   584  
   585  func (m *CustomFieldFilterLogic) validateValue(formats strfmt.Registry) error {
   586  
   587  	if err := validate.Required("filter_logic"+"."+"value", "body", m.Value); err != nil {
   588  		return err
   589  	}
   590  
   591  	// value enum
   592  	if err := m.validateValueEnum("filter_logic"+"."+"value", "body", *m.Value); err != nil {
   593  		return err
   594  	}
   595  
   596  	return nil
   597  }
   598  
   599  // ContextValidate validates this custom field filter logic based on context it is used
   600  func (m *CustomFieldFilterLogic) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   601  	return nil
   602  }
   603  
   604  // MarshalBinary interface implementation
   605  func (m *CustomFieldFilterLogic) MarshalBinary() ([]byte, error) {
   606  	if m == nil {
   607  		return nil, nil
   608  	}
   609  	return swag.WriteJSON(m)
   610  }
   611  
   612  // UnmarshalBinary interface implementation
   613  func (m *CustomFieldFilterLogic) UnmarshalBinary(b []byte) error {
   614  	var res CustomFieldFilterLogic
   615  	if err := swag.ReadJSON(b, &res); err != nil {
   616  		return err
   617  	}
   618  	*m = res
   619  	return nil
   620  }
   621  
   622  // CustomFieldType Type
   623  //
   624  // swagger:model CustomFieldType
   625  type CustomFieldType struct {
   626  
   627  	// label
   628  	// Required: true
   629  	// Enum: [Text Integer Boolean (true/false) Date URL Selection Multiple selection]
   630  	Label *string `json:"label"`
   631  
   632  	// value
   633  	// Required: true
   634  	// Enum: [text integer boolean date url select multiselect]
   635  	Value *string `json:"value"`
   636  }
   637  
   638  // Validate validates this custom field type
   639  func (m *CustomFieldType) Validate(formats strfmt.Registry) error {
   640  	var res []error
   641  
   642  	if err := m.validateLabel(formats); err != nil {
   643  		res = append(res, err)
   644  	}
   645  
   646  	if err := m.validateValue(formats); err != nil {
   647  		res = append(res, err)
   648  	}
   649  
   650  	if len(res) > 0 {
   651  		return errors.CompositeValidationError(res...)
   652  	}
   653  	return nil
   654  }
   655  
   656  var customFieldTypeTypeLabelPropEnum []interface{}
   657  
   658  func init() {
   659  	var res []string
   660  	if err := json.Unmarshal([]byte(`["Text","Integer","Boolean (true/false)","Date","URL","Selection","Multiple selection"]`), &res); err != nil {
   661  		panic(err)
   662  	}
   663  	for _, v := range res {
   664  		customFieldTypeTypeLabelPropEnum = append(customFieldTypeTypeLabelPropEnum, v)
   665  	}
   666  }
   667  
   668  const (
   669  
   670  	// CustomFieldTypeLabelText captures enum value "Text"
   671  	CustomFieldTypeLabelText string = "Text"
   672  
   673  	// CustomFieldTypeLabelInteger captures enum value "Integer"
   674  	CustomFieldTypeLabelInteger string = "Integer"
   675  
   676  	// CustomFieldTypeLabelBooleanTrueFalse captures enum value "Boolean (true/false)"
   677  	CustomFieldTypeLabelBooleanTrueFalse string = "Boolean (true/false)"
   678  
   679  	// CustomFieldTypeLabelDate captures enum value "Date"
   680  	CustomFieldTypeLabelDate string = "Date"
   681  
   682  	// CustomFieldTypeLabelURL captures enum value "URL"
   683  	CustomFieldTypeLabelURL string = "URL"
   684  
   685  	// CustomFieldTypeLabelSelection captures enum value "Selection"
   686  	CustomFieldTypeLabelSelection string = "Selection"
   687  
   688  	// CustomFieldTypeLabelMultipleSelection captures enum value "Multiple selection"
   689  	CustomFieldTypeLabelMultipleSelection string = "Multiple selection"
   690  )
   691  
   692  // prop value enum
   693  func (m *CustomFieldType) validateLabelEnum(path, location string, value string) error {
   694  	if err := validate.EnumCase(path, location, value, customFieldTypeTypeLabelPropEnum, true); err != nil {
   695  		return err
   696  	}
   697  	return nil
   698  }
   699  
   700  func (m *CustomFieldType) validateLabel(formats strfmt.Registry) error {
   701  
   702  	if err := validate.Required("type"+"."+"label", "body", m.Label); err != nil {
   703  		return err
   704  	}
   705  
   706  	// value enum
   707  	if err := m.validateLabelEnum("type"+"."+"label", "body", *m.Label); err != nil {
   708  		return err
   709  	}
   710  
   711  	return nil
   712  }
   713  
   714  var customFieldTypeTypeValuePropEnum []interface{}
   715  
   716  func init() {
   717  	var res []string
   718  	if err := json.Unmarshal([]byte(`["text","integer","boolean","date","url","select","multiselect"]`), &res); err != nil {
   719  		panic(err)
   720  	}
   721  	for _, v := range res {
   722  		customFieldTypeTypeValuePropEnum = append(customFieldTypeTypeValuePropEnum, v)
   723  	}
   724  }
   725  
   726  const (
   727  
   728  	// CustomFieldTypeValueText captures enum value "text"
   729  	CustomFieldTypeValueText string = "text"
   730  
   731  	// CustomFieldTypeValueInteger captures enum value "integer"
   732  	CustomFieldTypeValueInteger string = "integer"
   733  
   734  	// CustomFieldTypeValueBoolean captures enum value "boolean"
   735  	CustomFieldTypeValueBoolean string = "boolean"
   736  
   737  	// CustomFieldTypeValueDate captures enum value "date"
   738  	CustomFieldTypeValueDate string = "date"
   739  
   740  	// CustomFieldTypeValueURL captures enum value "url"
   741  	CustomFieldTypeValueURL string = "url"
   742  
   743  	// CustomFieldTypeValueSelect captures enum value "select"
   744  	CustomFieldTypeValueSelect string = "select"
   745  
   746  	// CustomFieldTypeValueMultiselect captures enum value "multiselect"
   747  	CustomFieldTypeValueMultiselect string = "multiselect"
   748  )
   749  
   750  // prop value enum
   751  func (m *CustomFieldType) validateValueEnum(path, location string, value string) error {
   752  	if err := validate.EnumCase(path, location, value, customFieldTypeTypeValuePropEnum, true); err != nil {
   753  		return err
   754  	}
   755  	return nil
   756  }
   757  
   758  func (m *CustomFieldType) validateValue(formats strfmt.Registry) error {
   759  
   760  	if err := validate.Required("type"+"."+"value", "body", m.Value); err != nil {
   761  		return err
   762  	}
   763  
   764  	// value enum
   765  	if err := m.validateValueEnum("type"+"."+"value", "body", *m.Value); err != nil {
   766  		return err
   767  	}
   768  
   769  	return nil
   770  }
   771  
   772  // ContextValidate validates this custom field type based on context it is used
   773  func (m *CustomFieldType) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   774  	return nil
   775  }
   776  
   777  // MarshalBinary interface implementation
   778  func (m *CustomFieldType) MarshalBinary() ([]byte, error) {
   779  	if m == nil {
   780  		return nil, nil
   781  	}
   782  	return swag.WriteJSON(m)
   783  }
   784  
   785  // UnmarshalBinary interface implementation
   786  func (m *CustomFieldType) UnmarshalBinary(b []byte) error {
   787  	var res CustomFieldType
   788  	if err := swag.ReadJSON(b, &res); err != nil {
   789  		return err
   790  	}
   791  	*m = res
   792  	return nil
   793  }