// Code generated by github.com/atombender/go-jsonschema, DO NOT EDIT.

package test

import "encoding/json"
import "fmt"
import yaml "gopkg.in/yaml.v3"

type AllOfWithIfThen struct {
	// Result corresponds to the JSON schema field "result".
	Result string `json:"result" yaml:"result" mapstructure:"result"`

	// Value corresponds to the JSON schema field "value".
	Value *string `json:"value,omitempty,omitzero" yaml:"value,omitempty" mapstructure:"value,omitempty"`
}

// UnmarshalJSON implements json.Unmarshaler.
func (j *AllOfWithIfThen) UnmarshalJSON(value []byte) error {
	var raw map[string]interface{}
	if err := json.Unmarshal(value, &raw); err != nil {
		return err
	}
	if _, ok := raw["result"]; raw != nil && !ok {
		return fmt.Errorf("field result in AllOfWithIfThen: required")
	}
	type Plain AllOfWithIfThen
	var plain Plain
	if err := json.Unmarshal(value, &plain); err != nil {
		return err
	}
	*j = AllOfWithIfThen(plain)
	return nil
}

// UnmarshalYAML implements yaml.Unmarshaler.
func (j *AllOfWithIfThen) UnmarshalYAML(value *yaml.Node) error {
	var raw map[string]interface{}
	if err := value.Decode(&raw); err != nil {
		return err
	}
	if _, ok := raw["result"]; raw != nil && !ok {
		return fmt.Errorf("field result in AllOfWithIfThen: required")
	}
	type Plain AllOfWithIfThen
	var plain Plain
	if err := value.Decode(&plain); err != nil {
		return err
	}
	*j = AllOfWithIfThen(plain)
	return nil
}
