// Package gen provides primitives to interact with the openapi HTTP API.
//
// Code generated by unknown module path version unknown version DO NOT EDIT.
package gen

import (
	"encoding/json"
	"fmt"
	"time"
)

const (
	ApiKeyScopes     = "ApiKey.Scopes"
	BasicAuthScopes  = "BasicAuth.Scopes"
	BearerAuthScopes = "BearerAuth.Scopes"
)

// Defines values for HealthModelStatus.
const (
	FAIL HealthModelStatus = "FAIL"
	PASS HealthModelStatus = "PASS"
	WARN HealthModelStatus = "WARN"
)

// Defines values for LinksModelOperation.
const (
	DELETE LinksModelOperation = "DELETE"
	GET    LinksModelOperation = "GET"
	HEAD   LinksModelOperation = "HEAD"
	PATCH  LinksModelOperation = "PATCH"
	POST   LinksModelOperation = "POST"
	PUT    LinksModelOperation = "PUT"
)

// Defines values for SearchqueryModelDeviceType.
const (
	ANDROID      SearchqueryModelDeviceType = "ANDROID"
	API          SearchqueryModelDeviceType = "API"
	CHROME       SearchqueryModelDeviceType = "CHROME"
	EDGE         SearchqueryModelDeviceType = "EDGE"
	FIREFOX      SearchqueryModelDeviceType = "FIREFOX"
	IOS          SearchqueryModelDeviceType = "IOS"
	OTHER        SearchqueryModelDeviceType = "OTHER"
	OTHERBROWSER SearchqueryModelDeviceType = "OTHERBROWSER"
)

// The entitlements associated with this investment account
type AccountAuthorisationModel struct {
	AllowReocurring           bool `json:"allow_reocurring"`
	CanBuy                    bool `json:"can_buy"`
	CanSell                   bool `json:"can_sell"`
	MaxImpulseInvestmentValue int  `json:"max_impulse_investment_value"`

	// The minimum investment value in a single trade.
	//
	// The defaults are:
	// * $0 for Pocket
	// * $500 for domestic
	// * $?? for crypto
	// * AUD$ ??? for international
	//
	// The above values are subject to change and are indicative.  You must
	// check against the vaue supplied.
	MinInvestmentValue float32 `json:"min_investment_value"`
}

// BankaccountModel defines model for bankaccount-model.
type BankaccountModel struct {
	// Internal UUID representation of the account number
	//
	// For privacy and security reasons the account number may not be
	// available in all services and the account_id can be used internally
	// to associate with th right resource.
	//
	// The account_id cannot be used externally for monetary transfers and
	// neither is it displayed to customers.
	AccountId string `json:"account_id"`

	// The banking account number
	//
	// The BSB is excluded from this value
	//
	// **Question** Can we mask the value with ### except the
	// last four digits, or should we have another attribute
	AccountNumber string `json:"account_number"`

	// Bank sub-branch
	//
	// A 6 digit number, sometimes represented as 123-456
	Bsb *string `json:"bsb,omitempty"`

	// Method of operation
	Moo *int32 `json:"moo,omitempty"`

	// Account name or title
	//
	// Commonly the default value is the name of the customer owning
	// the account
	Name string `json:"name"`
}

// A common error payload returned
// when the response code is not 2xx
type ErrorModel struct {
	// Error description, that shuld be less technical
	// and more user orientated where possible
	Message *string `json:"message,omitempty"`

	// Information on how the error or issue may
	// be resolved.
	Resolution *string `json:"resolution,omitempty"`

	// Status identifier that can be used to identify the
	// cause of the error.
	//
	// It s not the HTTP status code (eg 4xx ot 5xx)
	Status *string `json:"status,omitempty"`

	// Technical information for the error.
	//
	// This must not contain sensitive information
	Technical *string `json:"technical,omitempty"`
}

// The response object from a "health" request.
//
// The response may be full. partial, minimal or missing
// if the statsu is not "200"
type HealthModel struct {
	//   The "checks" object MAY have a number of unique keys, one for each
	//    logical downstream dependency or sub-component.  Since each sub-
	//    component may be backed by several nodes with varying health
	//    statuses, these keys point to arrays of objects.  In case of a
	//    single-node sub-component (or if presence of nodes is not relevant),
	//    a single-element array SHOULD be used as the value, for consistency.
	//
	//    The key identifying an element in the object SHOULD be a unique
	//    string within the details section.  It MAY have two parts:
	//    "{componentName}:{measurementName}", in which case the meaning of the
	//    parts SHOULD be as follows:
	//
	//    *  componentName: (optional) human-readable name for the component.
	//       MUST not contain a colon, in the name, since colon is used as a
	//       separator.
	//
	//    *  measurementName: (optional) name of the measurement type (a data
	//       point type) that the status is reported for.  MUST not contain a
	//       colon, in the name, since colon is used as a separator.  The
	//       observation's name can be one of:
	//
	//       -  A pre-defined value from this spec.  Pre-defined values
	//          include:
	//
	//          o  utilization
	//
	//          o  responseTime
	//
	//          o  connections
	//
	//          o  uptime
	//
	//       -  A common and standard term from a well-known source such as
	//          schema.org, IANA or microformats.
	//
	//       -  A URI that indicates extra semantics and processing rules that
	//          MAY be provided by a resource at the other end of the URI.
	//          URIs do not have to be dereferenceable, however.  They are just
	//          a namespace, and the meaning of a namespace CAN be provided by
	//          any convenient means (e.g. publishing an RFC, Open API Spec
	//          document or a nicely printed book).
	//
	//    On the value side of the equation, each "component details" object in
	//    the array SHOULD have at least one key.
	Checks HealthModel_Checks `json:"checks"`

	// A human-friendly description of the
	// service.
	Description *string `json:"description,omitempty"`

	// Links to additional information or actions for the resource
	Links []LinksModel `json:"links"`

	// Array of notes relevant to current state of health
	Notes *[]string `json:"notes,omitempty"`

	// Raw error output, in case of "fail" or "warn"
	// states.  This field SHOULD be omitted for "pass" state.
	Output *string `json:"output,omitempty"`

	// In well-designed APIs, backwards-compatible
	// changes in the service should not update a version number.  APIs
	// usually change their version number as infrequently as possible, to
	// preserve stable interface.  However, implementation of an API may
	// change much more frequently, which leads to the importance of having
	// separate "release number" or "releaseId" that is different from the
	// public version of the API.
	ReleaseId *string `json:"release_id,omitempty"`

	// A unique identofoer (UUID) for the service
	ServiceId *string `json:"service_id,omitempty"`

	//  Indicates whether the service status is acceptable
	//  or not
	//
	//  indicates whether the service status is acceptable
	//    or not.  API publishers SHOULD use following values for the field:
	//
	// * "pass": healthy (acceptable aliases: "ok" to support Node's
	//       Terminus and "up" for Java's SpringBoot),
	//
	// * "fail": unhealthy (acceptable aliases: "error" to support Node's
	//       Terminus and "down" for Java's SpringBoot), and
	//
	// * "warn": healthy, with some concerns.
	//
	//    The value of the status field is case-insensitive and is tightly
	//    related with the HTTP response code returned by the health endpoint.
	//    For "pass" status, HTTP response code in the 2xx-3xx range MUST be
	//    used.  For "fail" status, HTTP response code in the 4xx-5xx range
	//    MUST be used.  In case of the "warn" status, endpoints MUST return
	//    HTTP status in the 2xx-3xx range, and additional information SHOULD
	//    be provided, utilizing optional fields of the response.
	//
	//    A health endpoint is only meaningful in the context of the component
	//    it indicates the health of.  It has no other meaning or purpose.  As
	//    such, its health is a conduit to the health of the component.
	//    Clients SHOULD assume that the HTTP response code returned by the
	//    health endpoint is applicable to the entire component (e.g. a larger
	//    API or a microservice).  This is compatible with the behavior that
	//    current infrastructural tooling expects: load-balancers, service
	//    discoveries and others, utilizing health-checks.
	Status HealthModelStatus `json:"status"`

	// Public version of the service
	Version *string `json:"version,omitempty"`
}

//   The "checks" object MAY have a number of unique keys, one for each
//    logical downstream dependency or sub-component.  Since each sub-
//    component may be backed by several nodes with varying health
//    statuses, these keys point to arrays of objects.  In case of a
//    single-node sub-component (or if presence of nodes is not relevant),
//    a single-element array SHOULD be used as the value, for consistency.
//
//    The key identifying an element in the object SHOULD be a unique
//    string within the details section.  It MAY have two parts:
//    "{componentName}:{measurementName}", in which case the meaning of the
//    parts SHOULD be as follows:
//
//    *  componentName: (optional) human-readable name for the component.
//       MUST not contain a colon, in the name, since colon is used as a
//       separator.
//
//    *  measurementName: (optional) name of the measurement type (a data
//       point type) that the status is reported for.  MUST not contain a
//       colon, in the name, since colon is used as a separator.  The
//       observation's name can be one of:
//
//       -  A pre-defined value from this spec.  Pre-defined values
//          include:
//
//          o  utilization
//
//          o  responseTime
//
//          o  connections
//
//          o  uptime
//
//       -  A common and standard term from a well-known source such as
//          schema.org, IANA or microformats.
//
//       -  A URI that indicates extra semantics and processing rules that
//          MAY be provided by a resource at the other end of the URI.
//          URIs do not have to be dereferenceable, however.  They are just
//          a namespace, and the meaning of a namespace CAN be provided by
//          any convenient means (e.g. publishing an RFC, Open API Spec
//          document or a nicely printed book).
//
//    On the value side of the equation, each "component details" object in
//    the array SHOULD have at least one key.
type HealthModel_Checks struct {
	AdditionalProperties map[string][]HealthcheckModel `json:"-"`
}

//  Indicates whether the service status is acceptable
//  or not
//
//  indicates whether the service status is acceptable
//    or not.  API publishers SHOULD use following values for the field:
//
// * "pass": healthy (acceptable aliases: "ok" to support Node's
//       Terminus and "up" for Java's SpringBoot),
//
// * "fail": unhealthy (acceptable aliases: "error" to support Node's
//       Terminus and "down" for Java's SpringBoot), and
//
// * "warn": healthy, with some concerns.
//
//    The value of the status field is case-insensitive and is tightly
//    related with the HTTP response code returned by the health endpoint.
//    For "pass" status, HTTP response code in the 2xx-3xx range MUST be
//    used.  For "fail" status, HTTP response code in the 4xx-5xx range
//    MUST be used.  In case of the "warn" status, endpoints MUST return
//    HTTP status in the 2xx-3xx range, and additional information SHOULD
//    be provided, utilizing optional fields of the response.
//
//    A health endpoint is only meaningful in the context of the component
//    it indicates the health of.  It has no other meaning or purpose.  As
//    such, its health is a conduit to the health of the component.
//    Clients SHOULD assume that the HTTP response code returned by the
//    health endpoint is applicable to the entire component (e.g. a larger
//    API or a microservice).  This is compatible with the behavior that
//    current infrastructural tooling expects: load-balancers, service
//    discoveries and others, utilizing health-checks.
type HealthModelStatus string

// HealthcheckModel defines model for healthcheck-model.
type HealthcheckModel struct {
	AffectedEndPoints *[]string  `json:"affected_end_points,omitempty"`
	AsAt              *time.Time `json:"as_at,omitempty"`
	ComponentId       *string    `json:"component_id,omitempty"`
	ComponentType     *string    `json:"component_type,omitempty"`
	ObservedUnit      *string    `json:"observed_unit,omitempty"`
	ObservedValue     *float32   `json:"observed_value,omitempty"`
	Output            *string    `json:"output,omitempty"`
	Status            *string    `json:"status,omitempty"`
}

// Provides the identifiers for the investment asset and its
// value as reported from the source of record.
//
// The source of record for invetsment assets includes the
// registry holding the number of units and the
// market exchange value price of the investment asset
// as at date and time.
type HoldingModel struct {
	// Date and time when the information was last updated
	// from the source of record.  The information could
	// be cached and therefore the "as_at" might not be as
	// recent as anticipated.
	//
	// The date and time is in ISO8061 format.
	AsAt time.Time `json:"as_at"`

	// Unique holding identifier
	//
	// Per investmenttype, exchange and symbol combination there can only be
	// one holding identifier.
	HoldingId string `json:"holding_id"`

	// The investment account under which this holding is registered.
	//
	// The owner(s) of the investment acocunt are the owners of the
	// investment asset.
	InvestmentAccountId string `json:"investment_account_id"`

	// The code for investment type for the asset.
	//
	// The code is ALL UPPERCASE
	InvestmentType string `json:"investment_type"`

	// Links to additional information or actions for the resource
	Links []LinksModel `json:"links"`

	// The code for investment asset's exchange
	//
	// The code is ALL UPERCASE
	MarketPlace string `json:"market_place"`

	// The holding has pending BUY changes.
	//
	// An order has been placed but has not been settled as yet whch will
	// impact the value of the holding.
	//
	// The current values do not include pending orders.
	PendingBuy float32 `json:"pending_buy"`

	// The holding has pending SELL changes.
	//
	// An order has been placed but has not been settled as yet whch will
	// impact the value of the holding.
	//
	// The current values do not include pending orders.
	PendingSell float32 `json:"pending_sell"`

	// Number of asset symbols held currently
	//
	// This can be fractal if allowed for the symbol
	Quantity float32 `json:"quantity"`

	// Symbol code for the asset
	//
	// The code is ALL UPPERCASE
	Symbol string `json:"symbol"`
}

// Provides the identifiers for the asset and its
// value as reported from the source of record.
//
// The source of record for assets includes the
// registry holding the number of units and the
// market exchange as to the price of the asset
// as at date and time.
type HoldingModelBrief struct {
	// Date and time when the information was last updated
	// from the source of record.  The information could
	// be cached and therefore the "as_at" might not be as
	// recent as anticipated.
	//
	// The date and time is in ISO8061 format.
	AsAt time.Time `json:"as_at"`

	// Unique holding identifier
	//
	// Per investmenttype, exchange and symbol combination there can only be
	// one holding identifier.
	HoldingId string `json:"holding_id"`

	// The investment account associated with the
	// investor entity.  This is unique to the investment account
	// registry.
	//
	// An investor can have multiple investment accounts
	InvestmentAccountId string `json:"investment_account_id"`
	InvestmentType      string `json:"investment_type"`

	// Links to additional information or actions for the resource
	Links       []LinksModel `json:"links"`
	MarketPlace string       `json:"market_place"`

	// Number of assets held.
	//
	// This can be fractal if allowed for the asset.
	Quantity float32 `json:"quantity"`
	Symbol   string  `json:"symbol"`
}

// HoldinglistModel defines model for holdinglist-model.
type HoldinglistModel struct {
	// Date and time when the information was last updated
	// from the source of record.  The information could
	// be cached and therefore the "as_at" might not be as
	// recent as anticipated.
	//
	// The date and time is in ISO8061 format.
	AsAt time.Time `json:"as_at"`

	// List of holdigngs for the investent account.
	//
	// Depeding on the type of account this could be items
	// like:
	// * SHARE
	// * ETF
	// * CRYPTO
	//
	// Investment accounts can have rules about the kind of financial assets
	// they can hold.  For example a CRYPTO account is unlikley to allow
	// SHARE holdings.
	Holdings []HoldingModelBrief `json:"holdings"`

	// Links to additional information or actions for the resource
	Links []LinksModel `json:"links"`

	// Meta data for lists.
	//
	// This is returned for all list services.
	Meta MetaList `json:"meta"`
}

// Investment information
type InvestmentModel struct {
	AsAt        time.Time    `json:"as_at"`
	Caption     string       `json:"caption"`
	Description *string      `json:"description,omitempty"`
	Links       []LinksModel `json:"links"`
}

// InvestmentaccountModel defines model for investmentaccount-model.
type InvestmentaccountModel struct {
	// Date and time when the information was last updated
	// from the source of record.  The information could
	// be cached and therefore the "as_at" might not be as
	// recent as anticipated.
	//
	// The date and time is in ISO8061 format.
	AsAt *time.Time `json:"as_at,omitempty"`

	// Describes the types of holdigs the investment account
	// can manage.
	HoldingRules []RuleholdingModel `json:"holding_rules"`

	// The investment account associated with the
	// investor entity.  This is unique to the investment account
	// registry.
	//
	// An investor can have multiple investment accounts.
	InvestmentAccountId string `json:"investment_account_id"`

	// The investment account number displayed to the investor.
	// This is unique to the investment account registry.
	InvestmentAccountNumber *string `json:"investment_account_number,omitempty"`

	// Investors and other enities with an associated role to the investment account entity
	Investors []InvestorroleModel `json:"investors"`

	// Links to additional information or actions for the resource
	Links []LinksModel `json:"links"`

	// Name allocated to the investment account
	Name string `json:"name"`

	// Product identifier
	ProductId         string            `json:"product_id"`
	SettlementAccount *BankaccountModel `json:"settlement_account,omitempty"`
}

// InvestmentaccountlistModel defines model for investmentaccountlist-model.
type InvestmentaccountlistModel struct {
	// List of investment accounts
	//
	// Only accounts authorised to be accessed are listed.
	Accounts []InvestmentaccountModel `json:"accounts"`

	// Date and time when the information was last updated
	// from the source of record.  The information could
	// be cached and therefore the "as_at" might not be as
	// recent as anticipated.
	//
	// The date and time is in ISO8061 format.
	AsAt time.Time `json:"as_at"`

	// Links to additional information or actions for the resource
	Links []LinksModel `json:"links"`

	// Meta data for lists.
	//
	// This is returned for all list services.
	Meta MetaList `json:"meta"`
}

// The investor and role for the investment account.
type InvestorroleModel struct {
	// The  party identifier.  An investment account can have
	// many parties authorised to access and/or operate the account.
	//
	// Thr roles can include viewing, owneing, trasnact, power of attorney.
	//
	// A party can have more than one role and in which case there are multiple records.
	PartyId string `json:"party_id"`

	// Role that the party has.
	//
	// There is only one role per record.
	//
	// The standard roles are:
	//
	// 1. OWNER
	// 2. OPERATE
	// 3. POA (power of attorney)
	// 4. VIEW
	Role string `json:"role"`
}

// Hypermedia links see https://restfulapi.net/hateoas/
type LinksModel struct {
	Caption *string `json:"caption,omitempty"`

	// The hypermedia link for the information request
	Href string `json:"href"`

	// This is the media type for the request and / or repsonse.
	//
	// For GET methods the media type is for the response
	MediaType *string `json:"media_type,omitempty"`

	// When referring to a HTTP request, the method used for the
	// hypermedia link
	Operation *LinksModelOperation `json:"operation,omitempty"`

	// The relationships for the hypermedia link to the current resource.
	//
	// The common values are:
	//
	// * self : this resource.  Normally used in lists,
	// * first : the first resource in a list,
	// * last : the last resource in a list,
	// * next : the next resource or page in a list,
	// * prev : the previous resource or page in a list
	// * create : create a resource
	// * update : update a resource
	// * delete : delete a resource
	// * parent : link to parent resource
	//
	// An example use case for "parent" is when the resource is a "holding" then the parent
	// resource is the investment account.  For investment accounts the parent resource is
	// the investor.
	//
	// See individual components for specific values supported.
	Rel string `json:"rel"`
}

// When referring to a HTTP request, the method used for the
// hypermedia link
type LinksModelOperation string

// Meta data for lists.
//
// This is returned for all list services.
type MetaList struct {
	// A flag to indicate the total number of records
	// is incomplete and there are more records.
	//
	// The service has stopped further processing
	// and so has not arrived at a total number for the
	// reason that the number is large and to determine
	// a true number would require extra processing and
	// delay the results being returned.
	//
	// If displaying the total records or pages, you may consider
	// adding a "+" symbol to denote more.
	IncompleteTotal bool `json:"incomplete_total"`

	// The page size for pagination
	PageSize int `json:"page_size"`

	// The total number of pages in the list.
	//
	// The value will be 0 if there are no records, otherwise
	// if there are records in the list the value
	// will be an integer valuue of 1 or greater.
	//
	// This value can be used in pagination
	TotalPages int32 `json:"total_pages"`

	// The total number of records in the list
	// across all pages.
	//
	// The valuue must be 0 (zero) or a positive integer
	TotalRecords int32 `json:"total_records"`
}

// RegisterModel defines model for register-model.
type RegisterModel struct {
	// This is the investors (CRN) channel identifier
	//
	// An investor can have multiple investment accounts but these are linked by
	// customer identifier and/or the channel identifier.
	//
	// If a channel identifier is not supplied and none exist for
	// the investor a value will be created.  If there is no channel
	// identifier for the customer then a new set of
	// credentials are required.
	//
	// Existing investors do not need to create a new credential.
	ChannelId string `json:"channel_id"`

	// If the investor does not currently have an existing
	// active investment account ( you can have multiple) then a
	// new set of credentials are required.
	//
	// Existing investors do not need to create a new credential.
	Credential *string `json:"credential,omitempty"`

	// Unique customer identifier
	//
	// A legal enity has only on unique customer identifier.  If two exists
	// they are merged and there is a surviving customer identifier.
	CustomerId string `json:"customer_id"`

	// The offer code for a product and account
	OfferId           *string           `json:"offer_id,omitempty"`
	SettlementAccount *BankaccountModel `json:"settlement_account,omitempty"`
}

// Rule for investment account
// on the holdings it allows.
type RuleholdingModel struct {
	Exchange       *string `json:"exchange,omitempty"`
	InvestmentType *string `json:"investment_type,omitempty"`
}

// The agreement segment is to identify the
// unique agreement identifier for the product.
//
// As products can have different registries there
// can be collisions between identifiers
//
// If all the products use a unique identifier such
// as UUID within an organisation then the cheance of
// collision is highly unlikely.
//
// The identifier in this segment does not need
// to be the agreement (accout) identifier that
// is communicated with the customer.
//
// To locate the customer known and communicated identifier
// you need to use the id with the product registry
// to get the appropriate value(s)
type SearchagreementModel struct {
	// Agreement identifier.
	//
	// The agreement could be a banking account (includding any routing)
	// insurance contract, investment account, etc
	Id *string `json:"id,omitempty"`

	// Product identifier.
	//
	// The product identifier along with agreement identifer will give
	// a unique identifier as different product systems may
	// have the same agreement id by chance.
	ProductId *string `json:"product_id,omitempty"`
}

// Search request that can further refine the results
// required per category.
//
// If the category is supplied then the search implies
// including only the categories mentioned and
// exclude other catagories.
type SearchcategoryModel struct {
	// Code for the category.
	//
	// If the code is not recognised then the
	// service will return an error and no
	// results.
	CategoryId string `json:"category_id"`

	// Maximum number of results returned for the category
	MaxResults *int32 `json:"max_results,omitempty"`

	// The page number of the results to return if there is
	// more than one page.
	//
	// An invalid page nuber will return an error and no
	// results.
	PageNo *int `json:"page_no,omitempty"`

	// The size of each results page. The default size is dynamic but constant for
	// the same search session.
	//
	// An invalid page size will return an error and no
	// results.
	PageSize *int `json:"page_size,omitempty"`
}

// SearchcontextModel defines model for searchcontext-model.
type SearchcontextModel struct {
	Key            string                       `json:"key"`
	SupportingData *[]SearchsupportingdataModel `json:"supporting_data,omitempty"`
	Value          *string                      `json:"value,omitempty"`
}

// SearchlocationModel defines model for searchlocation-model.
type SearchlocationModel struct {
	Latitude  *string `json:"latitude,omitempty"`
	Longitude *string `json:"longitude,omitempty"`
}

// SearchofficeuseModel defines model for searchofficeuse-model.
type SearchofficeuseModel struct {
	DepartmentId *string `json:"department_id,omitempty"`
	EmployeeId   *string `json:"employee_id,omitempty"`
}

// # Search Query Model
//
// Request information for search.
//
// By using a more complex structure for search
// it is possible to fine tune the results.
//
//
// ## Global Search Query
//
// The definition here is a global definition that is being
// applied to the category of Investment Products.
//
// The results are only for this service domain.
type SearchqueryModel struct {
	// The application name making the search request.
	//
	// This is the consumer application name in most cases but could
	// be an automated system that needs to identify the location of
	// an item. System queries should be rare and require discussion
	// before implementation as there are impacts that need approval.
	AppName *string `json:"app_name,omitempty"`

	// The screen or place in the application making the
	// search request.  This information is useful
	// as a context in which to rank the results.
	AppPlace *string `json:"app_place,omitempty"`

	// Version of the application
	//
	// This is in recognition of the fact that if the search
	// results link to an item in the application, then
	// a link understood by that application **and** version
	// needs to be returned.
	AppVersion *string `json:"app_version,omitempty"`

	// List of arrangements that are used to match the results.
	//
	// Arrangements includes bank accounts, investment accounts,
	// insurance policies, safe custody product, etc
	Arrangements *[]SearchagreementModel `json:"arrangements,omitempty"`

	// # Category searching
	//
	// The category is optional.
	//
	// The category is used to signal to the search engine
	// the area of interest for the search.
	//
	// Only matching items from the category wil be included in the results
	//
	// ## Example 1
	//
	// If the category "investing" then investing results will be returned.
	Category *[]SearchcategoryModel `json:"category,omitempty"`

	// The type of device the search query is made from.
	DeviceType *SearchqueryModelDeviceType `json:"device_type,omitempty"`

	// The locale of the search.
	//
	// This is of the standard form.
	//
	// Examples are:
	//
	// * en
	// * en-us
	// * en-au
	// * fr
	// * fr-ch
	Locale   *string              `json:"locale,omitempty"`
	Location *SearchlocationModel `json:"location,omitempty"`

	// The maximum number of query results returned.
	//
	// If not specified, the default value of 80 is used
	//
	// This is the maximum number across each category and
	// not per category.
	MaxResults *int32                `json:"max_results,omitempty"`
	OfficeUse  *SearchofficeuseModel `json:"office_use,omitempty"`

	// This is the party in whose context the search is being made.
	//
	// For example the party identifier coudl be that for a customer
	// and their role being an agreement owner.  Therefore the search results
	// will favour items that are related to their accounts especially the
	// ones listed in their agreement list.
	PartyId *string `json:"party_id,omitempty"`

	// The role of the party that has been supplied.
	//
	// The role is not a must if a party id has been supplied.
	PartyType *string `json:"party_type,omitempty"`

	// The search string or input
	//
	// If multiple words are used then the results where the multiple occur are
	// given a higher priority over those with only a single word match
	//
	// If an exact match is required then _use single quotes_ around the search string.
	//
	// **Note**: The search string is not case sensitive
	Query string `json:"query"`

	// # Context searching
	//
	// The context is used to signal to the search engine
	// the area of interest for the search.
	//
	// Matching items to the search string will be given a
	// higher priority in the results if they are from the
	// context.
	//
	// ## Example 1
	//
	// If the context includes "fromDate" and "todDate", then the results will
	// favour transactions between the two dates.
	//
	SessionContext *[]SearchcontextModel `json:"session_context,omitempty"`
}

// The type of device the search query is made from.
type SearchqueryModelDeviceType string

// SearchresultList defines model for searchresult-list.
type SearchresultList struct {
	// Internal identifier for result group.
	ExperimentalGroup *string `json:"experimental_group,omitempty"`

	// Links to additional information or actions for the resource
	Links []LinksModel `json:"links"`

	// Meta data for lists.
	//
	// This is returned for all list services.
	Meta MetaList `json:"meta"`

	// A list of found matches to the category
	// for the the search criteria
	SearchCategoryResults []SearchresultcategoryModel `json:"search_category_results"`

	// Unique identifier for the search request
	SearchIdentifier string `json:"search_identifier"`
}

// SearchresultcategoryModel defines model for searchresultcategory-model.
type SearchresultcategoryModel struct {
	// A summary caption associated with the category.
	//
	// This is not the category name.
	Caption *string `json:"caption,omitempty"`

	// Category code
	CategoryId string `json:"category_id"`

	// Group value for the category
	ExperimentalGroup *string `json:"experimental_group,omitempty"`

	// An optional icon for the category
	Icon *string `json:"icon,omitempty"`

	// A flag to indicate if the category results are
	// a partial result or complete. In some cases the
	// search engine may not be able to complete the
	// complete search, such as timeout or other
	// technical issue, resulting partial result lists.
	//
	// This is not the same as pagination returning
	// a partial result.
	IsPartialResult *bool `json:"is_partial_result,omitempty"`

	// Link to category search result item
	Link *string `json:"link,omitempty"`

	// Links to additional information or actions for the category
	Links []LinksModel `json:"links"`

	// Meta data for lists.
	//
	// This is returned for all list services.
	Meta MetaList `json:"meta"`

	// Category name that can be used as header / section lead.
	Name string `json:"name"`

	// Order for the category within the result list of categories.
	//
	// Individual items under this category have their own
	// sub order within the category.
	Order int32 `json:"order"`

	// List of search item results within the category.
	SearchItemResults []SearchresultitemModel `json:"search_item_results"`

	// Supporting data for the category
	SupportingData []SearchsupportingdataModel `json:"supporting_data"`
}

// A single item that matches the query or search request
type SearchresultitemModel struct {
	// A short summary of the index item.
	//
	// This could be a snippet of text based on the search query.
	Caption string `json:"caption"`

	// Extended, longer text for the item.
	//
	// The text can be in markdown format.
	EnhancedText *string `json:"enhanced_text,omitempty"`

	// Group value for the item
	ExperimentalGroup *string `json:"experimental_group,omitempty"`

	// An optional icon or small image that can be displayed along the
	// search result caption
	Icon *string `json:"icon,omitempty"`

	// Unique identifier for the index item
	//
	// This is the identifier within the source system from
	// which the item was indexed.
	//
	// Multiple result items can return the same identifier
	// if they refer to the same item in the source system
	ItemId *string `json:"item_id,omitempty"`

	// A link to the item
	Link string `json:"link"`

	// The order of the item in the search results.
	//
	// This is expected to the index (1 based index)
	// of the result in the list.
	Order int `json:"order"`

	// Unique search identifier for the index item
	//
	// This value is provided on the feedback to search when the user actions
	// the search link.
	SearchId string `json:"search_id"`

	// Supporting data for the item
	SupportingData []SearchsupportingdataModel `json:"supporting_data"`
}

// Supporting data for the context.
//
// This provides an extension to the
// primary key value pair data for the context
// if required.
type SearchsupportingdataModel struct {
	// Key identifying the value.
	//
	// The key is unique within the set of supporting data
	KeyName string `json:"key_name"`

	// Data value associated with the key
	KeyValue string `json:"key_value"`
}

// GetInvestmentsParams defines parameters for GetInvestments.
type GetInvestmentsParams struct {
	XCustomerID *string `json:"X-CustomerID,omitempty"`
}

// GetInvestmentsDetailsParams defines parameters for GetInvestmentsDetails.
type GetInvestmentsDetailsParams struct {
	Investorid  *string `form:"investorid,omitempty" json:"investorid,omitempty"`
	XCustomerId *string `json:"X-CustomerId,omitempty"`
}

// GetInvestmentsInvestmentAccountIdParams defines parameters for GetInvestmentsInvestmentAccountId.
type GetInvestmentsInvestmentAccountIdParams struct {
	XCustomerId *string `json:"X-CustomerId,omitempty"`
}

// PostInvestmentsInvestmentAccountIdJSONBody defines parameters for PostInvestmentsInvestmentAccountId.
type PostInvestmentsInvestmentAccountIdJSONBody = HoldingModel

// PostInvestmentsInvestmentAccountIdParams defines parameters for PostInvestmentsInvestmentAccountId.
type PostInvestmentsInvestmentAccountIdParams struct {
	XCustomerId *string `json:"X-CustomerId,omitempty"`
}

// GetInvestmentsInvestmentAccountIdAuthorisationParams defines parameters for GetInvestmentsInvestmentAccountIdAuthorisation.
type GetInvestmentsInvestmentAccountIdAuthorisationParams struct {
	XCustomerID *string `json:"X-CustomerID,omitempty"`
}

// GetInvestmentsInvestmentAccountIdDetailsParams defines parameters for GetInvestmentsInvestmentAccountIdDetails.
type GetInvestmentsInvestmentAccountIdDetailsParams struct {
	XCustomerID *string `json:"X-CustomerID,omitempty"`
}

// GetInvestmentsInvestmentAccountIdHoldingsHoldingIdParams defines parameters for GetInvestmentsInvestmentAccountIdHoldingsHoldingId.
type GetInvestmentsInvestmentAccountIdHoldingsHoldingIdParams struct {
	XCustomerId *string `json:"X-CustomerId,omitempty"`
}

// PostRegisterJSONBody defines parameters for PostRegister.
type PostRegisterJSONBody = RegisterModel

// PostRegisterParams defines parameters for PostRegister.
type PostRegisterParams struct {
	XCustomerID *string `json:"X-CustomerID,omitempty"`
}

// GetSearchParams defines parameters for GetSearch.
type GetSearchParams struct {
	// Query request as a simple string.  For example:
	//
	// "/search?q=ETHI"
	//
	// will return only those resources with the matching symbol
	Q string `form:"q" json:"q"`

	// Version of the API end point being requested.
	XV *int `json:"x-v,omitempty"`

	// Minimum version of the API end point requested.
	XMinV *int `json:"x-min-v,omitempty"`

	// Value of the Interaction ID of the request.
	XFapiInteractionId *string `json:"x-fapi-interaction-id,omitempty"`
}

// PostSearchJSONBody defines parameters for PostSearch.
type PostSearchJSONBody = SearchqueryModel

// PostSearchParams defines parameters for PostSearch.
type PostSearchParams struct {
	// Version of the API end point being requested.
	XV *int `json:"x-v,omitempty"`

	// Minimum version of the API end point requested.
	XMinV *int `json:"x-min-v,omitempty"`

	// Value of the Interaction ID of the request.
	XFapiInteractionId *string `json:"x-fapi-interaction-id,omitempty"`
}

// GetStatusParams defines parameters for GetStatus.
type GetStatusParams struct {
	XCustomerID *string `json:"X-CustomerID,omitempty"`
}

// PostInvestmentsInvestmentAccountIdJSONRequestBody defines body for PostInvestmentsInvestmentAccountId for application/json ContentType.
type PostInvestmentsInvestmentAccountIdJSONRequestBody = PostInvestmentsInvestmentAccountIdJSONBody

// PostRegisterJSONRequestBody defines body for PostRegister for application/json ContentType.
type PostRegisterJSONRequestBody = PostRegisterJSONBody

// PostSearchJSONRequestBody defines body for PostSearch for application/json ContentType.
type PostSearchJSONRequestBody = PostSearchJSONBody

// Getter for additional properties for HealthModel_Checks. Returns the specified
// element and whether it was found
func (a HealthModel_Checks) Get(fieldName string) (value []HealthcheckModel, found bool) {
	if a.AdditionalProperties != nil {
		value, found = a.AdditionalProperties[fieldName]
	}
	return
}

// Setter for additional properties for HealthModel_Checks
func (a *HealthModel_Checks) Set(fieldName string, value []HealthcheckModel) {
	if a.AdditionalProperties == nil {
		a.AdditionalProperties = make(map[string][]HealthcheckModel)
	}
	a.AdditionalProperties[fieldName] = value
}

// Override default JSON handling for HealthModel_Checks to handle AdditionalProperties
func (a *HealthModel_Checks) UnmarshalJSON(b []byte) error {
	object := make(map[string]json.RawMessage)
	err := json.Unmarshal(b, &object)
	if err != nil {
		return err
	}

	if len(object) != 0 {
		a.AdditionalProperties = make(map[string][]HealthcheckModel)
		for fieldName, fieldBuf := range object {
			var fieldVal []HealthcheckModel
			err := json.Unmarshal(fieldBuf, &fieldVal)
			if err != nil {
				return fmt.Errorf("error unmarshaling field %s: %w", fieldName, err)
			}
			a.AdditionalProperties[fieldName] = fieldVal
		}
	}
	return nil
}

// Override default JSON handling for HealthModel_Checks to handle AdditionalProperties
func (a HealthModel_Checks) MarshalJSON() ([]byte, error) {
	var err error
	object := make(map[string]json.RawMessage)

	for fieldName, field := range a.AdditionalProperties {
		object[fieldName], err = json.Marshal(field)
		if err != nil {
			return nil, fmt.Errorf("error marshaling '%s': %w", fieldName, err)
		}
	}
	return json.Marshal(object)
}
