All Downloads are FREE. Search and download functionalities are using the official Maven repository.

Org.Isda.Cdm.Classes.daml Maven / Gradle / Ivy

daml 1.2

-- | This file is auto-generated from the ISDA Common
--   Domain Model, do not edit.
--   @version 6.0.0-dev.82
module Org.Isda.Cdm.Classes
  ( module Org.Isda.Cdm.Classes ) where

import Org.Isda.Cdm.Enums
import Org.Isda.Cdm.ZonedDateTime
import Org.Isda.Cdm.MetaClasses
import Org.Isda.Cdm.MetaFields
import Prelude hiding (Party, exercise, id, product, agreement)

-- | A class to specify an account as an account number
--   alongside, optionally. an account name, an account
--   type, an account beneficiary and a servicing party.
data Account = Account with 
  partyReference : Optional (ReferenceWithMeta Party)
    -- ^ A reference to the party to which the account refers
    --   to.
  accountNumber : (FieldWithMeta Text)
    -- ^ The account number.
  accountName : Optional (FieldWithMeta Text)
    -- ^ The name by which the account is known.
  accountType : Optional (FieldWithMeta AccountTypeEnum)
    -- ^ The type of account, e.g. client, house.
  accountBeneficiary : Optional (ReferenceWithMeta Party)
    -- ^ A reference to the party beneficiary of the account.
  servicingParty : Optional (ReferenceWithMeta Party)
    -- ^ The reference to the legal entity that services the
    --   account, i.e. in the books of which the account is
    --   held.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

data AcctOwnr = AcctOwnr with 
  id : Id
    deriving (Eq, Ord, Show)

-- | A type for defining the Additional Disruption Events.
data AdditionalDisruptionEvents = AdditionalDisruptionEvents with 
  changeInLaw : Optional Bool
    -- ^ Per 2002 ISDA Equity Derivatives Definitions: 
  failureToDeliver : Optional Bool
    -- ^ Per 2002 ISDA Equity Derivatives Definitions
  insolvencyFiling : Optional Bool
    -- ^ Per 2002 ISDA Equity Derivatives Definitions
  hedgingDisruption : Optional Bool
    -- ^ Per 2002 ISDA Equity Derivatives Definitions
  increasedCostOfHedging : Optional Bool
    -- ^ Per 2002 ISDA Equity Derivatives Definitions
  foreignOwnershipEvent : Optional Bool
    -- ^ Per ISDA Def 
  lossOfStockBorrow : Optional Bool
    -- ^ Per 2002 ISDA Equity Derivatives Definitions:
  maximumStockLoanRate : Optional Decimal
    -- ^ Specifies the maximum stock loan rate for Loss of
    --   Stock Borrow. A percentage of 5% is represented as
    --   0.05.
  increasedCostOfStockBorrow : Optional Bool
    -- ^ Per 2002 ISDA Equity Derivatives Definitions
  initialStockLoanRate : Optional Decimal
    -- ^ Specifies the initial stock loan per ISDA Def. A
    --   percentage of 5% is represented as 0.05.
  determiningParty : Optional AncillaryRoleEnum
    -- ^ Specifies the party which determines additional
    --   disruption events.
  additionalBespokeTerms : [Clause]
    -- ^ Where parties may optionnaly describe any extra
    --   bespoke agreements, in regards of the standardized
    --   Extraordinary Events.
    deriving (Eq, Ord, Show)

-- | A class to specify the events that will give rise to
--   the payment additional fixed payments.
data AdditionalFixedPayments = AdditionalFixedPayments with 
  interestShortfallReimbursement : Optional Bool
    -- ^ An additional Fixed Payment Event. Corresponds to the
    --   payment by or on behalf of the Issuer of an actual
    --   interest amount in respect to the reference
    --   obligation that is greater than the expected interest
    --   amount. ISDA 2003 Term: Interest Shortfall
    --   Reimbursement.
  principalShortfallReimbursement : Optional Bool
    -- ^ An additional Fixed Payment Event. Corresponds to the
    --   payment by or on behalf of the Issuer of an actual
    --   principal amount in respect to the reference
    --   obligation that is greater than the expected
    --   principal amount. ISDA 2003 Term: Principal Shortfall
    --   Reimbursement.
  writedownReimbursement : Optional Bool
    -- ^ An Additional Fixed Payment. Corresponds to the
    --   payment by or on behalf of the issuer of an amount in
    --   respect to the reference obligation in reduction of
    --   the prior writedowns. ISDA 2003 Term: Writedown
    --   Reimbursement.
    deriving (Eq, Ord, Show)

-- | A class to specify a post or street address.
data Address = Address with 
  street : [Text]
    -- ^ The set of street and building number information
    --   that identifies a postal address within a city.
  city : Optional Text
    -- ^ The city component of the postal address.
  state : Optional Text
    -- ^ A country subdivision used in postal addresses in
    --   some countries. For example, US states, Canadian
    --   provinces, Swiss cantons, ...
  country : Optional (FieldWithMeta Text)
    -- ^ The ISO 3166 standard code for the country within
    --   which the postal address is located.
  postalCode : Optional Text
    -- ^ The code, required for computerized mail sorting
    --   systems, that is allocated to a physical address by a
    --   national postal authority.
    deriving (Eq, Ord, Show)

-- | Specification of the address and other details for
--   notices.
data AddressForNotices = AddressForNotices with 
  primaryNotices : ContactElection
    -- ^ Specification of primary notice details
  additionalNotices : [PartyContactInformation]
    -- ^ The optional specification of additional information
    --   when a party requires notices to be delivered to more
    --   than one address.
    deriving (Eq, Ord, Show)

data AddtlAttrbts = AddtlAttrbts with 
  rskRdcgTx : Text
  sctiesFincgTxInd : Text
    deriving (Eq, Ord, Show)

-- | A class for defining a date that shall be subject to
--   adjustment if it would otherwise fall on a day that
--   is not a business day in the specified business
--   centers, together with the convention for adjusting
--   the date.
data AdjustableDate = AdjustableDate with 
  unadjustedDate : Optional Date
    -- ^ A date subject to adjustment. While in FpML this date
    --   is required, this cardinality constraint has been
    --   relaxed as part of the CDM in order to support the
    --   FRA representation, which effective and termination
    --   dates are specified in FpML as adjusted dates.
  dateAdjustments : Optional BusinessDayAdjustments
    -- ^ The business day convention and financial business
    --   centers used for adjusting the date if it would
    --   otherwise fall on a day that is not a business date
    --   in the specified business centers.
  dateAdjustmentsReference : Optional (ReferenceWithMeta BusinessDayAdjustments)
    -- ^ A pointer style reference to date adjustments defined
    --   elsewhere in the document.
  adjustedDate : Optional (FieldWithMeta Date)
    -- ^ The date once the adjustment has been performed.
    --   (Note that this date may change if the business
    --   center holidays change).
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A class for defining a series of dates that shall be
--   subject to adjustment if they would otherwise fall on
--   a day that is not a business day in the specified
--   business centers, together with the convention for
--   adjusting the dates.
data AdjustableDates = AdjustableDates with 
  unadjustedDate : [Date]
    -- ^ A date subject to adjustment.
  dateAdjustments : Optional BusinessDayAdjustments
    -- ^ The business day convention and financial business
    --   centers used for adjusting the date if it would
    --   otherwise fall on a day that is not a business date
    --   in the specified business centers.
  adjustedDate : [FieldWithMeta Date]
    -- ^ The date(s) once the adjustment has been performed.
    --   (Note that this date may change if the business
    --   center holidays change).
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A class for defining a date that shall be subject to
--   adjustment if it would otherwise fall on a day that
--   is not a business day in the specified business
--   centers, together with the convention for adjusting
--   the date.
data AdjustableOrAdjustedDate = AdjustableOrAdjustedDate with 
  unadjustedDate : Optional Date
    -- ^ A date subject to adjustment.
  dateAdjustments : Optional BusinessDayAdjustments
    -- ^ The business day convention and financial business
    --   centers used for adjusting the date if it would
    --   otherwise fall on a day that is not a business date
    --   in the specified business centers.
  adjustedDate : Optional (FieldWithMeta Date)
    -- ^ The date once the adjustment has been performed.
    --   (Note that this date may change if the business
    --   center holidays change).
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | This Rosetta class specifies the date as either an
--   unadjusted, adjusted or relative date. It supplements
--   the features of the AdjustableOrAdjustedDate to
--   support the credit default swap option premium, which
--   uses the relative date construct.
data AdjustableOrAdjustedOrRelativeDate = AdjustableOrAdjustedOrRelativeDate with 
  unadjustedDate : Optional Date
    -- ^ A date subject to adjustment.
  dateAdjustments : Optional BusinessDayAdjustments
    -- ^ The business day convention and financial business
    --   centers used for adjusting the date if it would
    --   otherwise fall on a day that is not a business date
    --   in the specified business centers.
  adjustedDate : Optional (FieldWithMeta Date)
    -- ^ The date once the adjustment has been performed.
    --   (Note that this date may change if the business
    --   center holidays change).
  relativeDate : Optional RelativeDateOffset
    -- ^ A date specified as some offset to another date (the
    --   anchor date).
    deriving (Eq, Ord, Show)

-- | A class giving the choice between defining a date as
--   an explicit date together with applicable adjustments
--   or as relative to some other (anchor) date.
data AdjustableOrRelativeDate = AdjustableOrRelativeDate with 
  adjustableDate : Optional AdjustableDate
    -- ^ A date that shall be subject to adjustment if it
    --   would otherwise fall on a day that is not a business
    --   day in the specified business centers, together with
    --   the convention for adjusting the date.
  relativeDate : Optional AdjustedRelativeDateOffset
    -- ^ A date specified as some offset to another date (the
    --   anchor date).
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A class giving the choice between defining a series
--   of dates as an explicit list of dates together with
--   applicable adjustments or as relative to some other
--   series of (anchor) dates.
data AdjustableOrRelativeDates = AdjustableOrRelativeDates with 
  adjustableDates : Optional AdjustableDates
    -- ^ A series of dates that shall be subject to adjustment
    --   if they would otherwise fall on a day that is not a
    --   business day in the specified business centers,
    --   together with the convention for adjusting the date.
  relativeDates : Optional RelativeDates
    -- ^ A series of dates specified as some offset to another
    --   series of dates (the anchor dates).
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A class giving the choice between defining a series
--   of dates as an explicit list of dates together with
--   applicable adjustments or as relative to some other
--   series of (anchor) dates, or as a calculation period
--   schedule.
data AdjustableRelativeOrPeriodicDates = AdjustableRelativeOrPeriodicDates with 
  adjustableDates : Optional AdjustableDates
    -- ^ A series of dates that shall be subject to adjustment
    --   if they would otherwise fall on a day that is not a
    --   business day in the specified business centers,
    --   together with the convention for adjusting the date.
  relativeDates : Optional RelativeDates
    -- ^ A series of dates specified as some offset to another
    --   series of dates (the anchor dates).
  periodicDates : Optional PeriodicDates
    -- ^ A calculation period schedule.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A type defining a date (referred to as the derived
--   date) as a relative offset from another date
--   (referred to as the anchor date) plus optional date
--   adjustments.
data AdjustedRelativeDateOffset = AdjustedRelativeDateOffset with 
  periodMultiplier : Int
    -- ^ A time period multiplier, e.g. 1, 2 or 3 etc. A
    --   negative value can be used when specifying an offset
    --   relative to another date, e.g. -2 days.
  period : PeriodEnum
    -- ^ A time period, e.g. a day, week, month or year of the
    --   stream. If the periodMultiplier value is 0 (zero)
    --   then period must contain the value D (day).
  meta : Optional MetaFields
  dayType : Optional DayTypeEnum
    -- ^ In the case of an offset specified as a number of
    --   days, this element defines whether consideration is
    --   given as to whether a day is a good business day or
    --   not. If a day type of business days is specified then
    --   non-business days are ignored when calculating the
    --   offset. The financial business centers to use for
    --   determination of business days are implied by the
    --   context in which this element is used. This element
    --   must only be included when the offset is specified as
    --   a number of days. If the offset is zero days then the
    --   dayType element should not be included.
  businessDayConvention : BusinessDayConventionEnum
    -- ^ The convention for adjusting a date if it would
    --   otherwise fall on a day that is not a business day,
    --   as specified by an ISDA convention (e.g. Following,
    --   Precedent).
  businessCenters : Optional BusinessCenters
  businessCentersReference : Optional (ReferenceWithMeta BusinessCenters)
    -- ^ A pointer style reference to a set of financial
    --   business centers defined elsewhere in the document.
    --   This set of business centers is used to determine
    --   whether a particular day is a business day or not.
  dateRelativeTo : Optional (BasicReferenceWithMeta Date)
    -- ^ Specifies the anchor as an href attribute. The href
    --   attribute value is a pointer style reference to the
    --   element or component elsewhere in the document where
    --   the anchor date is defined.
  adjustedDate : Optional Date
    -- ^ The date once the adjustment has been performed.
    --   (Note that this date may change if the business
    --   center holidays change).
  relativeDateAdjustments : Optional BusinessDayAdjustments
    -- ^ The business day convention and financial business
    --   centers used for adjusting the relative date if it
    --   would otherwise fall on a day that is not a business
    --   date in the specified business centers.
    deriving (Eq, Ord, Show)

-- | Represents a class to specify multiple credit
--   notations alongside a conditional 'any' or
--   'all' qualifier.
data AgencyRatingCriteria = AgencyRatingCriteria with 
  qualifier : QuantifierEnum
    -- ^ Indicates whether all or any agency ratings apply.
  creditNotation : [CreditNotation]
    -- ^ Indicates the agency rating criteria specified for
    --   the asset or issuer.
  mismatchResolution : Optional CreditNotationMismatchResolutionEnum
    -- ^ Indicator for options to be used if several agency
    --   ratings (>1) are specified and its necessary to
    --   identify specific charateristics. i.e (lowest or
    --   highest).
  referenceAgency : Optional CreditRatingAgencyEnum
    -- ^ identifies the dominant reference agency if there is
    --   a missmatch and several reference agencies exsist.
  boundary : Optional CreditNotationBoundaryEnum
    -- ^ Indicates the boundary of a credit agency rating i.e
    --   minimum or maximum.
    deriving (Eq, Ord, Show)

-- | Parameters to be used to filter events that are
--   relevant to a given portfolio in order to calculate
--   the state of this portfolio. The attributes
--   correspond to all the possible aggregation criteria
--   that can be used and these criteria can be combined.
--   All the attributes are optional.
data AggregationParameters = AggregationParameters with 
  dateTime : ZonedDateTime
    -- ^ To aggregate as of a particular date
  totalPosition : Optional Bool
    -- ^ Specifies whether to calculate total position to
    --   given date, or only daily position for the given
    --   date.
  positionStatus : Optional PositionStatusEnum
    -- ^ To aggregate based on position status (EXECUTED,
    --   SETTLED etc)
  party : [ReferenceWithMeta Party]
    -- ^ To aggregate based on a selection of party(ies) /
    --   legal entity(ies).
  product : [NonTransferableProduct]
    -- ^ To aggregate based on a selection of products.
  productQualifier : [Text]
    -- ^ To aggregate based on a selection of product type(s).
  tradeReference : [ReferenceWithMeta Trade]
    deriving (Eq, Ord, Show)

-- | Specification of the standard set of terms that
--   define a legal agreement.
data Agreement = Agreement with 
  creditSupportAgreementElections : Optional CreditSupportAgreementElections
    -- ^ Elections to specify a Credit Support Annex or Credit
    --   Support Deed for Intial or Variation Margin.
  collateralTransferAgreementElections : Optional CollateralTransferAgreementElections
    -- ^ Elections to specify a Collateral Transfer Agreement.
  securityAgreementElections : Optional SecurityAgreementElections
    -- ^ Elections to specify a Security agreement.
  masterAgreementSchedule : Optional MasterAgreementSchedule
    -- ^ Elections to specify a Master Agreement Schedule.
  transactionAdditionalTerms : Optional TransactionAdditionalTerms
    -- ^ Any additional terms which mainly intend to specify
    --   the extraordinary events that may affect a trade and
    --   the related contractual rights and obligation of the
    --   parties when this happens
    deriving (Eq, Ord, Show)

-- | Specifies the agreement name through an agreement
--   type and optional detailed sub agreement type.
data AgreementName = AgreementName with 
  agreementType : LegalAgreementTypeEnum
    -- ^ Specification of the legal agreement type.
  creditSupportAgreementType : Optional (FieldWithMeta CreditSupportAgreementTypeEnum)
    -- ^ Specification of the credit support agreement type.
  creditSupportAgreementMarginType : Optional CollateralMarginTypeEnum
    -- ^ specifies the type of margin for which a legal
    --   agreement is named.
  contractualDefinitionsType : [FieldWithMeta ContractualDefinitionsEnum]
    -- ^ The definitions such as those published by ISDA that
    --   will define the terms of the trade.
  contractualTermsSupplement : [ContractualTermsSupplement]
    -- ^ A contractual supplement (such as those published by
    --   ISDA) that will apply to the trade.
  contractualMatrix : [ContractualMatrix]
    -- ^ A reference to a contractual matrix of elected
    --   terms/values (such as those published by ISDA) that
    --   shall be deemed to apply to the trade. The applicable
    --   matrix is identified by reference to a name and
    --   optionally a publication date. Depending on the
    --   structure of the matrix, an additional term
    --   (specified in the matrixTerm element) may be required
    --   to further identify a subset of applicable
    --   terms/values within the matrix.
  masterAgreementType : Optional (FieldWithMeta MasterAgreementTypeEnum)
    -- ^ Specification of the master agreement type.
  masterConfirmationType : Optional (FieldWithMeta MasterConfirmationTypeEnum)
    -- ^ The type of master confirmation executed between the
    --   parties.
  masterConfirmationAnnexType : Optional (FieldWithMeta MasterConfirmationAnnexTypeEnum)
    -- ^ The type of master confirmation annex executed
    --   between the parties.
  otherAgreement : Optional Text
    -- ^ Definition of an agreement that is not enumerated in
    --   the CDM.
    deriving (Eq, Ord, Show)

-- | Specification of the content of a legal agreement.
data AgreementTerms = AgreementTerms with 
  agreement : Agreement
    -- ^ Specification of the standard set of terms that
    --   define a legal agreement.
  clauseLibrary : Optional Bool
    -- ^ Specification of whether the agreement terms have
    --   been negotiated using the clause library methodology.
  counterparty : [Counterparty]
    -- ^ Specification of the roles of the counterparties to
    --   the agreement.
    deriving (Eq, Ord, Show)

-- | A class to specify a currency amount or a currency
--   amount schedule.
data AmountSchedule = AmountSchedule with 
  value : Decimal
    -- ^ The initial rate or amount, as the case may be. An
    --   initial rate of 5% would be represented as 0.05.
  datedValue : [DatedValue]
    -- ^ The schedule of step date and value pairs. On each
    --   step date the associated step value becomes
    --   effective. A list of steps may be ordered in the
    --   document by ascending step date. An FpML document
    --   containing an unordered list of steps is still
    --   regarded as a conformant document.
  currency : [FieldWithMeta Text]
    -- ^ The currency in which the amount schedule is
    --   denominated. The currency is specified outside of the
    --   actual schedule in order to be applied uniformly to
    --   it. The list of valid currencies is not presently
    --   positioned as an enumeration as part of the CDM
    --   because that scope is limited to the values specified
    --   by ISDA and FpML. As a result, implementers have to
    --   make reference to the relevant standard, such as the
    --   ISO 4217 standard for currency codes.
    deriving (Eq, Ord, Show)

-- | Holds an identifier for an ancillary entity, either
--   identified directly via its ancillary role or
--   directly as a legal entity.
data AncillaryEntity = AncillaryEntity with 
  ancillaryParty : Optional AncillaryRoleEnum
    -- ^ Identifies a party via its ancillary role on a
    --   transaction (e.g. CCP or DCO through which the trade
    --   should be cleared.)
  legalEntity : Optional LegalEntity
    deriving (Eq, Ord, Show)

-- | Defines an ancillary role enumerated value with an
--   associated party reference. The product is agnostic
--   to the actual parties involved in the transaction,
--   with the party references abstracted away from the
--   product definition and replaced by the
--   AncillaryRoleEnum. The AncillaryRoleEnum can then be
--   positioned in the product and this AncillaryParty
--   type, which is positioned outside of the product
--   definition, allows the AncillaryRoleEnum to be
--   associated with an actual party reference.
data AncillaryParty = AncillaryParty with 
  role : AncillaryRoleEnum
    -- ^ Specifies the AncillaryRoleEnum that is associated to
    --   the party reference. An ancillary party is any
    --   involved party that is not one of the two principal
    --   parties to the transaction.
  partyReference : [ReferenceWithMeta Party]
    -- ^ Specifies the party, or parties, associated to the
    --   ancillary role.
  onBehalfOf : Optional CounterpartyRoleEnum
    -- ^ Optionally specifies the counterparty that the
    --   ancillary party is acting on behalf of.
    deriving (Eq, Ord, Show)

-- | As per ISDA 2002 Definitions.
data Asian = Asian with 
  averagingInOut : AveragingInOutEnum
  strikeFactor : Optional Decimal
    -- ^ The factor of strike.
  averagingPeriodIn : Optional AveragingPeriod
    -- ^ The averaging in period.
  averagingPeriodOut : Optional AveragingPeriod
    -- ^ The averaging out period.
    deriving (Eq, Ord, Show)

-- | An Asset is defined as something that can be owned
--   and transferred in the financial markets. As a choice
--   data type, one and only one of the attributes must be
--   used.
data Asset = Asset with 
  cash : Optional Cash
    -- ^ An Asset that consists solely of a monetary holding
    --   in a currency.
  commodity : Optional (FieldWithMeta Commodity)
    -- ^ An Asset comprised of raw or refined materials or
    --   agricultural products, eg gold, oil or wheat.
  digitalAsset : Optional DigitalAsset
    -- ^ An Asset that exists only in digital form, eg Bitcoin
    --   or Ethereum; excludes the digital representation of
    --   other Assets.
  instrument : Optional Instrument
    -- ^ An asset that is issued by one party to one or more
    --   others; Instrument is also a choice data type.
    deriving (Eq, Ord, Show)

-- | The base data type to specify common attributes for
--   all Assets.
data AssetBase = AssetBase with 
  identifier : [AssetIdentifier]
    -- ^ Asset Identifiers are used to uniquely identify an
    --   Asset, using a specified Asset Identifier Type.
  taxonomy : [Taxonomy]
    -- ^ Defines the taxonomy of an object by combining a
    --   taxonomy source (i.e. the rules to classify the
    --   object) and a value (i.e. the output of those rules
    --   on the object.
  isExchangeListed : Optional Bool
    -- ^ Defines whether the Asset is listed on a public
    --   exchange.
  exchange : Optional LegalEntity
    -- ^ If the Asset is listed, defines the public exchange
    --   of the listing.
  relatedExchange : [LegalEntity]
    -- ^ Provides the related Exchanges, if applicable.
    deriving (Eq, Ord, Show)

-- | Represents a set of criteria used to specify eligible
--   collateral assets.
data AssetCriteria = AssetCriteria with 
  collateralAssetType : [AssetType]
    -- ^ Represents a filter based on the asset product type.
  assetCountryOfOrigin : [ISOCountryCodeEnum]
    -- ^ Represents a filter on the asset country of origin
    --   based on the ISO Standard 3166.
  denominatedCurrency : [CurrencyCodeEnum]
    -- ^ Represents a filter on the underlying asset
    --   denominated currency based on ISO Standards.
  agencyRating : [AgencyRatingCriteria]
    -- ^ Represents an agency rating based on default risk and
    --   creditors claim in event of default associated with
    --   specific instrument.
  maturityType : Optional MaturityTypeEnum
    -- ^ Specifies whether the maturity range is the remaining
    --   or original maturity.
  maturityRange : Optional PeriodRange
    -- ^ Represents a filter based on the underlying asset
    --   maturity.
  specificAssets : [Asset]
    -- ^ Represents a filter based on specifically identified
    --   assets (eg certain securities, loans, or commodities,
    --   etc), including using source identifiers such as
    --   CUSIP or ISIN.
  collateralTaxonomy : [CollateralTaxonomy]
    -- ^ Specifies the collateral taxonomy,which is composed
    --   of a taxonomy value and a taxonomy source.
  domesticCurrencyIssued : Optional Bool
    -- ^ Identifies that the Security must be denominated in
    --   the domestic currency of the issuer.
  listing : Optional ListingType
    -- ^ Specifies the exchange, index or sector specific to
    --   listing of a security.
    deriving (Eq, Ord, Show)

-- | Contains the information relative to the delivery of
--   the asset.
data AssetDeliveryInformation = AssetDeliveryInformation with 
  periods : Optional AssetDeliveryPeriods
    -- ^ Defines the periods of delivery, including the
    --   delivery profile.
  location : [LocationIdentifier]
    -- ^ Defines the location of the delivery of the
    --   commodity.
  deliveryCapacity : Optional Quantity
    -- ^ The number of units included in the transaction for
    --   each delivery interval
    deriving (Eq, Ord, Show)

-- | Defines the periods of delivery, including the
--   delivery profile.
data AssetDeliveryPeriods = AssetDeliveryPeriods with 
  profile : [AssetDeliveryProfile]
    -- ^ Defines the delivery profile of the asset, including
    --   the load type and the delivery intervals.
  startDate : Optional Date
    -- ^ Delivery start date
  endDate : Optional Date
    -- ^ Delivery end date
    deriving (Eq, Ord, Show)

-- | Defines the delivery profile of the asset, including
--   the load type and the delivery intervals.
data AssetDeliveryProfile = AssetDeliveryProfile with 
  loadType : Optional LoadTypeEnum
    -- ^ Identification of the delivery profile.
  block : [AssetDeliveryProfileBlock]
    -- ^ Defines a delivery profile block, including start and
    --   end time, days of the week, duration, delivery
    --   capacity and price time interval quantity.
  bankHolidaysTreatment : Optional BankHolidayTreatmentEnum
    -- ^ Specifies whether the dates defined include holidays
    --   or not.
    deriving (Eq, Ord, Show)

-- | Defines a delivery profile block, including start and
--   end time, days of the week, duration, delivery
--   capacity and price time interval quantity.
data AssetDeliveryProfileBlock = AssetDeliveryProfileBlock with 
  startTime : Optional Text
    -- ^ The start time of the delivery interval for each
    --   block or shape.
  endTime : Optional Text
    -- ^ The end time of the delivery interval for each block
    --   or shape.
  dayOfWeek : [DayOfWeekEnum]
    -- ^ The days of the week of the delivery.
  deliveryCapacity : Optional Quantity
    -- ^ The number of units included in the transaction for
    --   each delivery interval
  priceTimeIntervalQuantity : Optional Price
    -- ^ Price per quantity per delivery time interval.
    deriving (Eq, Ord, Show)

-- | The unique identifier for an Asset, specified using
--   an Asset Identifier Type enumerator.
data AssetIdentifier = AssetIdentifier with 
  identifier : (FieldWithMeta Text)
    -- ^ The identifier value.
  identifierType : AssetIdTypeEnum
    -- ^ Defines the symbology source of the Asset Identifier,
    --   eg CUSIP, ISIN, etc.
    deriving (Eq, Ord, Show)

-- | Defines each asset movement of an asset payout.
data AssetLeg = AssetLeg with 
  settlementDate : AdjustableOrRelativeDate
    -- ^ Specifies the settlement date of securities.  In a
    --   repo transaction the purchase date would always be
    --   the effective date as specified under Economic Terms,
    --   the repurchase date would always be the termination
    --   date as specified under Economic Terms.
  deliveryMethod : DeliveryMethodEnum
    -- ^ Specifies a delivery method for the security
    --   transaction.
    deriving (Eq, Ord, Show)

-- | Security finance payout specification in case the
--   product payout involves some form of security
--   collateral, as in a securities financing transaction.
--   Plus additional description for ICMA.
data AssetPayout = AssetPayout with 
  payerReceiver : PayerReceiver
    -- ^ Canonical representation of the payer and receiver
    --   parties applicable to each payout leg.
  priceQuantity : Optional ResolvablePriceQuantity
    -- ^ Each payout leg must implement the quantity concept
    --   as a 'resolvable' type, which allows for
    --   different payout legs to be linked to each other
    --   (e.g. in the case of cross-curreny products).
  principalPayment : Optional PrincipalPayments
    -- ^ The specification of the principal exchange. Optional
    --   as only applicable in the case of cross-currency or
    --   zero-coupon swaps with a final payment.
  settlementTerms : Optional SettlementTerms
    -- ^ Each payout leg must specifies its settlement terms,
    --   including the delivery type (i.e. cash vs physical,
    --   and their respective terms), the transfer type (DvP
    --   etc.) and settlement date, if any.
  assetLeg : [AssetLeg]
    -- ^ Defines each asset movement as a buy/sell at
    --   different dates, typically 1 near leg and 1 far leg
    --   in a securities financing transaction.
  underlier : Asset
    -- ^ Specifies the Purchased Asset, usually a Security.
  minimumFee : Optional Money
    -- ^ A contractual minimum amount which the borrower will
    --   pay, regardless of the duration of the loan. A
    --   mechanism for making sure that a trade generates
    --   enough income.
  dividendTerms : Optional DividendTerms
    -- ^ Specifies the terms under which dividends received by
    --   the borrower are passed through to the lender.
  repoType : Optional RepoTypeEnum
    -- ^ Repurchase transactions and buy/sell-backs are both
    --   types of repo; this enumerator helps differentiate
    --   the two.
    deriving (Eq, Ord, Show)

-- | Represents a class to allow specification of the
--   asset product type.
data AssetType = AssetType with 
  assetType : AssetTypeEnum
    -- ^ Represents a filter based on the type of collateral
    --   asset.
  securityType : Optional InstrumentTypeEnum
    -- ^ Represents a filter based on the type of security.
  debtType : Optional DebtType
    -- ^ Represents a filter based on the type of bond.
  equityType : Optional EquityTypeEnum
    -- ^ Represents a filter based on the type of equity.
  fundType : Optional FundProductTypeEnum
    -- ^ Represents a filter based on the type of fund.
  otherAssetType : [Text]
    -- ^ Specifies the eligible asset type when not
    --   enumerated.
    deriving (Eq, Ord, Show)

-- | A class to specify the identifier value and its
--   associated version.
data AssignedIdentifier = AssignedIdentifier with 
  identifier : (FieldWithMeta Text)
    -- ^ The identifier value.
  version : Optional Int
    -- ^ The identifier version, which is specified as an
    --   integer and is meant to be incremented each time the
    --   transaction terms (whether contract or event) change.
    --   This version is made option to support the use case
    --   where the identifier is referenced without the
    --   version. The constraint that a contract and a
    --   lifecycle event need to have an associated version is
    --   enforced through data rules.
    deriving (Eq, Ord, Show)

-- | A type to define automatic exercise of a swaption.
--   With automatic exercise the option is deemed to have
--   exercised if it is in the money by more than the
--   threshold amount on the exercise date.
data AutomaticExercise = AutomaticExercise with 
  thresholdRate : Optional Decimal
    -- ^ A threshold rate. The threshold of 0.10% would be
    --   represented as 0.001
  isApplicable : Optional Bool
    -- ^ Boolean that indicates if it has an automaticExercise
    deriving (Eq, Ord, Show)

-- | A data type that can be used to describe the
--   inventory of securities that a party holds. The
--   securities are held in the AvailableInventoryRecord,
--   with each item in the array being an individual
--   security and its associated criteria. Criteria can
--   include the quantity available, the rate at which the
--   security is available to borrow at, as well as other
--   details that can affect the decision as to whether a
--   party wants to utilise the securities listed.
data AvailableInventory = AvailableInventory with 
  availableInventoryType : AvailableInventoryTypeEnum
    -- ^ Defines the purpose of this inventory.
  messageInformation : Optional MessageInformation
    -- ^ Allows details related to the availability messaging
    --   use case to be defined
  party : [Party]
    -- ^ Defines all parties involved for the list of
    --   inventory records in this set of inventory. For
    --   example, when used to describe securities lending
    --   availability, this could hold the sender of the
    --   availability, the intended recipient, the beneficial
    --   owner(s), the lender (which may differ from the
    --   sender as the lender may have the same piece of
    --   availability going through multiple agents), an agent
    --   or a venue.
  partyRole : [PartyRole]
    -- ^ Defines the role(s) that party(ies) may have in
    --   relation to the inventory.
  availableInventoryRecord : [AvailableInventoryRecord]
    -- ^ An array holding the list of inventory being
    --   described. Each element in the inventoryRecord array
    --   represents an individual piece of inventory i.e. a
    --   security.
    deriving (Eq, Ord, Show)

-- | An individual piece of available inventory. This
--   represents a single security and its associated
--   criteria. The criteria are used to describe any
--   restrictions on the securities.
data AvailableInventoryRecord = AvailableInventoryRecord with 
  identifer : AssignedIdentifier
    -- ^ Unique identifier for this record. This can be used
    --   to uniquely identify a specific piece of inventory.
  security : Security
    -- ^ The security details.
  expirationDateTime : Optional ZonedDateTime
    -- ^ There may be a set period/time restriction associated
    --   to the security.
  collateral : [CollateralProvisions]
    -- ^ The type of collateral can often be required when
    --   determining if the piece of availability being
    --   described is suitable for a party.
  partyRole : [PartyRole]
    -- ^ An individual security may be held by several agents.
    --   Including the party role at this level allows us to
    --   reference the party holding this specific item.
  quantity : Optional Quantity
    -- ^ The quantity of the security
  interestRate : Optional Price
    -- ^ An optional element which can be used to hold a rate
    --   associated to this piece of availability.
    deriving (Eq, Ord, Show)

-- | Represents the average trading volume of an Equity
--   product upon an exchange or set of exchanges.
data AverageTradingVolume = AverageTradingVolume with 
  period : Period
    -- ^ Represents the period of the equities average trading
    --   volume on the exchange/s.
  methodology : AverageTradingVolumeMethodologyEnum
    -- ^ Indicates the type of equity average trading volume
    --   being stated (single) the highest amount on one
    --   exchange, or (consolidated) volumes across multiple
    --   exchanges.
    deriving (Eq, Ord, Show)

-- | Defines parameters for use in cases when a valuation
--   or other term is based on an average of market
--   observations.
data AveragingCalculation = AveragingCalculation with 
  averagingMethod : AveragingCalculationMethod
    -- ^ Specifies enumerations for the type of averaging
    --   calculation.
  precision : Rounding
    -- ^ Rounding applied to the average calculation. 
    deriving (Eq, Ord, Show)

-- | Defines the ways in which multiple values can be
--   aggregated into a single value.
data AveragingCalculationMethod = AveragingCalculationMethod with 
  isWeighted : Bool
    -- ^ Identifies whether the average values will be
    --   weighted or unweighted.
  calculationMethod : AveragingCalculationMethodEnum
    -- ^ Identifies which of the Pythagorean means is being
    --   used to compute an average value.
    deriving (Eq, Ord, Show)

-- | An unordered list of weighted averaging observations.
data AveragingObservationList = AveragingObservationList with 
  averagingObservation : [WeightedAveragingObservation]
    -- ^ A single weighted averaging observation.
    deriving (Eq, Ord, Show)

-- | Period over which an average value is taken.
data AveragingPeriod = AveragingPeriod with 
  schedule : [AveragingSchedule]
    -- ^ A schedule for generating averaging observation
    --   dates.
  averagingDateTimes : Optional DateTimeList
    -- ^ An unweighted list of averaging observation date and
    --   times.
  averagingObservations : Optional AveragingObservationList
    -- ^ A weighted list of averaging observation date and
    --   times.
  marketDisruption : Optional (FieldWithMeta MarketDisruptionEnum)
    -- ^ The market disruption event as defined by ISDA 2002
    --   Definitions.
    deriving (Eq, Ord, Show)

-- | Class to representing a method for generating a
--   series of dates.
data AveragingSchedule = AveragingSchedule with 
  startDate : Date
    -- ^ Date on which this period begins.
  endDate : Date
    -- ^ Date on which this period ends.
  averagingPeriodFrequency : CalculationPeriodFrequency
    -- ^ The frequency at which averaging period occurs with
    --   the regular part of the valuation schedule and their
    --   roll date convention.
    deriving (Eq, Ord, Show)

-- | Defines the terms required to calculate the average
--   observations associated with an averaging strike.
data AveragingStrikeFeature = AveragingStrikeFeature with 
  averagingCalculation : AveragingCalculation
    -- ^ Defines parameters for use in cases when a valuation
    --   or other term is based on an average of market
    --   observations.
  observationTerms : ObservationTerms
    -- ^ Class containing terms that are associated with
    --   observing a price/benchmark/index across either
    --   single or multple observations. 
    deriving (Eq, Ord, Show)

-- | As per ISDA 2002 Definitions.
data Barrier = Barrier with 
  barrierCap : Optional TriggerEvent
    -- ^ A trigger level approached from beneath.
  barrierFloor : Optional TriggerEvent
    -- ^ A trigger level approached from above.
    deriving (Eq, Ord, Show)

-- | Defines a custom basket by referencing an identifier
--   and its constituents.
data Basket = Basket with 
  identifier : [AssetIdentifier]
    -- ^ Asset Identifiers are used to uniquely identify an
    --   Asset, using a specified Asset Identifier Type.
  taxonomy : [Taxonomy]
    -- ^ Defines the taxonomy of an object by combining a
    --   taxonomy source (i.e. the rules to classify the
    --   object) and a value (i.e. the output of those rules
    --   on the object.
  isExchangeListed : Optional Bool
    -- ^ Defines whether the Asset is listed on a public
    --   exchange.
  exchange : Optional LegalEntity
    -- ^ If the Asset is listed, defines the public exchange
    --   of the listing.
  relatedExchange : [LegalEntity]
    -- ^ Provides the related Exchanges, if applicable.
  basketConstituent : [FieldWithMeta BasketConstituent]
    -- ^ Identifies the constituents of the basket
    deriving (Eq, Ord, Show)

-- | Identifies the constituents of the basket
data BasketConstituent = BasketConstituent with 
  asset : Optional Asset
    -- ^ The object to be observed is an Asset, ie something
    --   that can be owned and transferred in the financial
    --   markets.
  basket : Optional Basket
    -- ^ The object to be observed is a Basket, ie a
    --   collection of Observables with an identifier and
    --   optional weightings.
  index : Optional Index
    -- ^ The object to be observed is an Index, ie an
    --   observable computed on the prices, rates or
    --   valuations of a number of assets.
  quantity : [ReferenceWithMeta NonNegativeQuantitySchedule]
    -- ^ Specifies a quantity schedule to be associated to an
    --   individual underlier that is a basket constituent.
    --   The multiple cardinality is aligned to the one of the
    --   PriceQuantity->quantity that this quantity is
    --   referencing.
  initialValuationPrice : [ReferenceWithMeta PriceSchedule]
    -- ^ Specifies an initial price schedule to be associated
    --   to an individual underlier that is a basket
    --   constituent. The multiple cardinality is aligned to
    --   the one of the PriceQuantity->price that this
    --   price is referencing.
  interimValuationPrice : [ReferenceWithMeta PriceSchedule]
    -- ^ Specifies an interim price schedule to be associated
    --   to an individual underlier that is a basket
    --   constituent. The multiple cardinality is aligned to
    --   the one of the PriceQuantity->price that this
    --   price is referencing.
  finalValuationPrice : [ReferenceWithMeta PriceSchedule]
    -- ^ Specifies a final price schedule to be associated to
    --   an individual underlier that is a basket constituent.
    --   The multiple cardinality is aligned to the one of the
    --   PriceQuantity->price that this price is
    --   referencing.
    deriving (Eq, Ord, Show)

-- | CDS Basket Reference Information.
data BasketReferenceInformation = BasketReferenceInformation with 
  basketName : Optional (FieldWithMeta Text)
    -- ^ The name of the basket expressed as a free format
    --   string. FpML does not define usage rules for this
    --   element.
  basketId : [FieldWithMeta Text]
    -- ^ A CDS basket identifier.
  referencePool : ReferencePool
    -- ^ This element contains all the reference pool items to
    --   define the reference entity and reference
    --   obligation(s) in the basket.
  nthToDefault : Optional Int
    -- ^ N th reference obligation to default triggers payout.
  mthToDefault : Optional Int
    -- ^ M th reference obligation to default to allow
    --   representation of N th to M th defaults.
  tranche : Optional Tranche
    -- ^ This element contains CDS tranche terms.
    deriving (Eq, Ord, Show)

-- | Specifies the instructions for creation of a Security
--   Lending billing invoice.
data BillingInstruction = BillingInstruction with 
  sendingParty : Party
    -- ^ The party issuing the invoice
  receivingParty : Party
    -- ^ The party receiving the invoice
  billingStartDate : Date
    -- ^ The starting date of the period described by this
    --   invoice
  billingEndDate : Date
    -- ^ The ending date of the period described by this
    --   invoice
  billingRecordInstruction : [BillingRecordInstruction]
    -- ^ Instructions for creating the billing records
    --   contained within the invoice
  billingSummary : [BillingSummaryInstruction]
    -- ^ The billing summaries contained within the invoice
    deriving (Eq, Ord, Show)

-- | Specifies individual records within a billing
--   invoice.
data BillingRecord = BillingRecord with 
  tradeState : (ReferenceWithMeta TradeState)
    -- ^ The trade for the individual billing record.
  recordTransfer : Transfer
    -- ^ The settlement terms for the billing record
  recordStartDate : Date
    -- ^ The starting date of the period described by this
    --   record
  recordEndDate : Date
    -- ^ The ending date of the period described by this
    --   record
  minimumFee : Optional Money
    -- ^ Indicates the minimum fee amount applied to the
    --   billing record, if any.
    deriving (Eq, Ord, Show)

-- | Specifies the instructions for creation of a billing
--   record.
data BillingRecordInstruction = BillingRecordInstruction with 
  tradeState : (ReferenceWithMeta TradeState)
    -- ^ The trade for the individual billing record.
  observation : [Observation]
    -- ^ The observations used to calculate the billing
    --   amount.
  recordStartDate : Date
    -- ^ The starting date of the period described by this
    --   record
  recordEndDate : Date
    -- ^ The ending date of the period described by this
    --   record
  settlementDate : Date
    -- ^ The date for settlement of the transfer.
    deriving (Eq, Ord, Show)

-- | Specifies individual summaries within a billing
--   invoice.
data BillingSummary = BillingSummary with 
  summaryTransfer : Optional Transfer
    -- ^ The settlement terms for the billing summary
  summaryAmountType : RecordAmountTypeEnum
    -- ^ The account level for the billing summary.
    deriving (Eq, Ord, Show)

-- | Specifies the instructions for creation of a billing
--   summary.
data BillingSummaryInstruction = BillingSummaryInstruction with 
  summaryAmountType : RecordAmountTypeEnum
    -- ^ The account level for the billing summary.
    deriving (Eq, Ord, Show)

-- | Reference to a bond underlier to represent an asset
--   swap or Condition Precedent Bond.
data BondReference = BondReference with 
  bond : Security
    -- ^ Reference to a bond underlier.
  conditionPrecedentBond : Bool
    -- ^ To indicate whether the Condition Precedent Bond is
    --   applicable. The swap contract is only valid if the
    --   bond is issued and if there is any dispute over the
    --   terms of fixed stream then the bond terms would be
    --   used.
  discrepancyClause : Optional Bool
    -- ^ To indicate whether the Discrepancy Clause is
    --   applicable.
  couponRate : Optional FixedRateSpecification
    -- ^ Specifies the coupon rate (expressed in percentage)
    --   of a fixed income security or convertible bond.
    deriving (Eq, Ord, Show)

-- | Describes correlation bounds, which form a cap and a
--   floor on the realized correlation.
data BoundedCorrelation = BoundedCorrelation with 
  minimumBoundaryPercent : Optional Decimal
    -- ^ Minimum Boundary as a percentage of the Strike Price.
  maximumBoundaryPercent : Optional Decimal
    -- ^ Maximum Boundary as a percentage of the Strike Price.
    deriving (Eq, Ord, Show)

data BoundedVariance = BoundedVariance with 
  realisedVarianceMethod : RealisedVarianceMethodEnum
    -- ^ The contract specifies which price must satisfy the
    --   boundary condition.
  daysInRangeAdjustment : Bool
    -- ^ The contract specifies whether the notional should be
    --   scaled by the Number of Days in Range divided by the
    --   Expected N. The number of Days in Ranges refers to
    --   the number of returns that contribute to the realized
    --   volatility.
  upperBarrier : Optional Decimal
    -- ^ All observations above this price level will be
    --   excluded from the variance calculation.
  lowerBarrier : Optional Decimal
    -- ^ All observations below this price level will be
    --   excluded from the variance calculation.
    deriving (Eq, Ord, Show)

-- | A class for defining a time with respect to a
--   business day calendar location. For example, 11:00:00
--   GBLO.
data BusinessCenterTime = BusinessCenterTime with 
  hourMinuteTime : Text
    -- ^ A time specified in hh:mm:ss format where the second
    --   component must be '00', e.g. 11am would be
    --   represented as 11:00:00.
  businessCenter : (FieldWithMeta BusinessCenterEnum)
    -- ^ A code identifying a business day calendar location.
    --   A business day calendar location is drawn from the
    --   list identified by the business day calendar location
    --   enumeration.
    deriving (Eq, Ord, Show)

-- | A class for specifying the business day calendar
--   location used in determining whether a day is a
--   business day or not, either by specifying this
--   business center by reference to an enumerated list
--   that is maintained by the FpML standard, or by
--   reference to such specification when it exists
--   elsewhere as part of the instance document. This
--   class corresponds to the FpML
--   BusinessCentersOrReference.model.
data BusinessCenters = BusinessCenters with 
  businessCenter : [FieldWithMeta BusinessCenterEnum]
    -- ^ A code identifying one or several business day
    --   calendar location(s). The set of business day
    --   calendar locations are specified by the business day
    --   calendar location enumeration which is maintained by
    --   the FpML standard.
  commodityBusinessCalendar : [FieldWithMeta CommodityBusinessCalendarEnum]
  businessCentersReference : Optional (ReferenceWithMeta BusinessCenters)
    -- ^ A reference to a financial business center location
    --   specified elsewhere in the instance document.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A class defining a range of contiguous business days
--   by defining an unadjusted first date, an unadjusted
--   last date and a business day convention and business
--   centers for adjusting the first and last dates if
--   they would otherwise fall on a non business day in
--   the specified business centers. The days between the
--   first and last date must also be good business days
--   in the specified centers to be counted in the range.
data BusinessDateRange = BusinessDateRange with 
  startDate : Date
    -- ^ The first date of a date range.
  endDate : Date
    -- ^ The last date of a date range.
  businessDayConvention : BusinessDayConventionEnum
    -- ^ The convention for adjusting a date if it would
    --   otherwise fall on a day that is not a business day,
    --   as specified by an ISDA convention (e.g. Following,
    --   Precedent).
  businessCenters : Optional BusinessCenters
    -- ^ The business center(s), specified either explicitly
    --   or by reference to those specified somewhere else in
    --   the instance document.
    deriving (Eq, Ord, Show)

-- | A class defining the business day convention and
--   financial business centers used for adjusting any
--   relevant date if it would otherwise fall on a day
--   that is not a business day in the specified business
--   center.
data BusinessDayAdjustments = BusinessDayAdjustments with 
  businessDayConvention : BusinessDayConventionEnum
    -- ^ The convention for adjusting a date if it would
    --   otherwise fall on a day that is not a business day.
  businessCenters : Optional BusinessCenters
    -- ^ The business center(s), specified either explicitly
    --   or by reference to those specified somewhere else in
    --   the instance document.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A business event represents a life cycle event of a
--   trade. The combination of the state changes results
--   in a qualifiable life cycle event. An example of a
--   Business Event is a PartialTermination which is a
--   defined by a quantity change primitive event.
data BusinessEvent = BusinessEvent with 
  intent : Optional EventIntentEnum
    -- ^ The intent attribute is meant to be specified when
    --   the event qualification cannot be programmatically
    --   inferred from the event features. As a result it is
    --   only associated with those primitives that can give
    --   way to such ambiguity, the quantityChange being one
    --   of those. An example of such is a reduction in the
    --   trade notional, which could be interpreted as either
    --   a trade correction (unless a maximum period of time
    --   post-event is specified as part of the
    --   qualification), a partial termination or a portfolio
    --   rebalancing in the case of an equity swap. On the
    --   other hand, an event such as the exercise is not
    --   expected to have an associated intent as there should
    --   not be ambiguity.
  corporateActionIntent : Optional CorporateActionTypeEnum
  eventDate : Optional Date
    -- ^ Specifies the date on which the event is taking
    --   place. This date is equal to the trade date in the
    --   case of a simple execution.  However it can be
    --   different from the trade date, for example in the
    --   case of a partial termination.
  effectiveDate : Optional Date
    -- ^ The date on which the event contractually takes
    --   effect, when different from the event date.
  packageInformation : Optional IdentifiedList
    -- ^ Specifies the package information in case the
    --   business event represents several trades executed as
    --   a package (hence this attribute is optional). The
    --   package information is only instantiated once at the
    --   business event level to preserve referential
    --   integrity, whereas individual trades make reference
    --   to it to identify that they are part of a package.
  instruction : [Instruction]
    -- ^ Specifies the instructions to create the Business
    --   Event.
  eventQualifier : Optional Text
    -- ^ The CDM event qualifier, which corresponds to the
    --   outcome of the isEvent qualification logic which
    --   qualifies the lifecycle event as a function of its
    --   features (e.g. PartialTermination,
    --   ClearingSubmission, Novation, ...).
  after : [TradeState]
    -- ^ Specifies the after trade state(s) created.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A class to specify an organizational unit.
data BusinessUnit = BusinessUnit with 
  name : Text
    -- ^ A name used to describe the organizational unit
  identifier : Optional Identifier
    -- ^ An identifier used to uniquely identify the
    --   organizational unit
  contactInformation : Optional ContactInformation
    -- ^ The contact information for such business unit, when
    --   different from the contact information associated
    --   with the party.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | This class corresponds to the FpML BuyerSeller.model
--   construct.
data BuyerSeller = BuyerSeller with 
  buyer : CounterpartyRoleEnum
    -- ^ Buyer party that can be resolved as one of the two
    --   principal parties to the transaction. The party that
    --   buys this instrument, i.e. pays for this instrument
    --   and receives the rights defined by it. ISDA 2002
    --   Equity Definitions section 1.18: `Buyer` means the
    --   party specified as such in the related Confirmation.
    --   | ISDA 2006 Definitions article 12.1 (b)(i) relating
    --   to a Swaption: 'Buyer' means the party that
    --   will, on each Premium Payment Date, pay to Seller the
    --   Premium | ISDA 2006 Definitions article 12.1 (b)(ii)
    --   relating to Swap Transactions with applicable Early
    --   Termination: the party specified as such in the
    --   related Confirmation, or the Exercising Party if
    --   neither party is specified | ISDA 2006 Definitions
    --   article 12.1 (b)(iii) relating to any other Option
    --   Transaction: the party specified as such in the
    --   related Confirmation. | ISDA 2014 Credit Definition
    --   article 1.4: `Buyer` means the Fixed Rate Payer.
  seller : CounterpartyRoleEnum
    -- ^ Seller party that can be resolved as one of the two
    --   principal parties to the transaction. The party that
    --   sells ('writes') this instrument, i.e. that
    --   grants the rights defined by this instrument and in
    --   return receives a payment for it. ISDA 2002 Equity
    --   Definitions section 1.19: `Seller` means the party
    --   specified as such in the related Confirmation. | ISDA
    --   2006 Definitions article 12.1 (a)(i) relating to a
    --   Swaption: 'Seller' means the party the party
    --   specified as such or as writer in the related
    --   Confirmation | ISDA 2006 Definitions article 12.1
    --   (a)(ii) relating to Swap Transactions with applicable
    --   Early Termination: the party specified as such or as
    --   writer in the related Confirmation or, if neither
    --   party is specified as such, the Non-exercising Party
    --   | ISDA 2006 Definitions article 12.1 (a)(iii)
    --   relating to any other Option Transaction: the party
    --   specified as such in the related Confirmation. | ISDA
    --   2014 Credit Definition article 1.4: `Seller` means
    --   the Floating Rate Payer.
    deriving (Eq, Ord, Show)

data Buyr = Buyr with 
  acctOwnr : AcctOwnr
    deriving (Eq, Ord, Show)

-- | Defines the tradeState or payout on which to create a
--   Transfer along with all necessary resets.
data CalculateTransferInstruction = CalculateTransferInstruction with 
  tradeState : TradeState
  payout : (ReferenceWithMeta Payout)
  resets : [Reset]
  payerReceiver : Optional PayerReceiver
  quantity : Optional Quantity
    -- ^ Specifies quantity amount returned if not the full
    --   amount from the TradeState, e.g. partial return
  date : Optional Date
    deriving (Eq, Ord, Show)

-- | Type for reporting details of calculated rates,
--   including the observations that went into the final
--   reported rate.
data CalculatedRateDetails = CalculatedRateDetails with 
  observations : Optional CalculatedRateObservations
    -- ^ The observation dates and weights for each
    --   observation date.
  weightedRates : [Decimal]
    -- ^ The weighted value of each observation.
  growthFactor : [Decimal]
    -- ^ The daily growth factors, showing the weighted rates
    --   divided by the day count basis plus one, giving how
    --   much the value grows for each step in the
    --   calculation.
  compoundedGrowth : [Decimal]
    -- ^ The compounding curve, showing how the initial value
    --   grew during the calculation period.
  aggregateValue : Optional Decimal
    -- ^ The total sum or product of all the individual terms
    --   that went into the calculated rate.
  aggregateWeight : Optional Decimal
    -- ^ The total weight of all the terms that went into the
    --   calculated rate.
  calculatedRate : Optional Decimal
    -- ^ The resulting calculated weight.
    deriving (Eq, Ord, Show)

-- | Type for reporting the observations dates and the
--   corresponding weights going into a daily calculated
--   rate
data CalculatedRateObservationDatesAndWeights = CalculatedRateObservationDatesAndWeights with 
  observationDates : [Date]
    -- ^ The observation date upon which the rate is observed.
  weights : [Decimal]
    -- ^ The corresponding weight for each date.
    deriving (Eq, Ord, Show)

-- | Type for reporting observations that went into the
--   final reported rate.
data CalculatedRateObservations = CalculatedRateObservations with 
  observationDates : [Date]
    -- ^ The observation date upon which the rate is observed.
  weights : [Decimal]
    -- ^ The corresponding weight for each date.
  observedRates : [Decimal]
    -- ^ The value observed for that date
  processedRates : [Decimal]
    -- ^ The value after any processing, such as application
    --   of caps or floors.
    deriving (Eq, Ord, Show)

-- | A class defining the ISDA calculation agent
--   responsible for performing duties as defined in the
--   applicable product definitions.
data CalculationAgent = CalculationAgent with 
  calculationAgentParty : Optional AncillaryRoleEnum
    -- ^ Specifies the party which is the ISDA Calculation
    --   Agent for the trade. If more than one party is
    --   referenced then the parties are assumed to be
    --   co-calculation agents, i.e. they have joint
    --   responsibility.
  calculationAgentPartyEnum : Optional PartyDeterminationEnum
    -- ^ Specifies the ISDA calculation agent responsible for
    --   performing duties as defined in the applicable
    --   product definitions. For example, the Calculation
    --   Agent may be defined as being the Non-exercising
    --   Party.
  calculationAgentBusinessCenter : Optional (FieldWithMeta BusinessCenterEnum)
    -- ^ The city in which the office through which ISDA
    --   Calculation Agent is acting for purposes of the
    --   transaction is located The short-form confirm for a
    --   trade that is executed under a Sovereign or Asia
    --   Pacific Master Confirmation Agreement ( MCA ), does
    --   not need to specify the Calculation Agent. However,
    --   the confirm does need to specify the Calculation
    --   Agent City. This is due to the fact that the MCA sets
    --   the value for Calculation Agent but does not set the
    --   value for Calculation Agent City.
    deriving (Eq, Ord, Show)

-- | Represents the parameters for describing how often
--   something (such as collateral interest) is to be
--   calculated.
data CalculationFrequency = CalculationFrequency with 
  period : Period
    -- ^ Specifies the time period at which calculation is
    --   performed, e.g. 1 month.
  monthOfYear : Optional Decimal
    -- ^ Specifies the month of the year if used.
  dayOfMonth : Optional Decimal
    -- ^ Specifies the day of the month if used.
  dayOfWeek : Optional DayOfWeekEnum
    -- ^ Specifies the day of the week if used.
  weekOfMonth : Optional Decimal
    -- ^ Specifies the week of the month if used.
  offsetDays : Decimal
    -- ^ Specifies how many days from the trigger event should
    --   the payment occur.
  dateLocation : BusinessCenterTime
    -- ^ Specifies where is the time measured.
  businessCenter : [BusinessCenterEnum]
    -- ^ Specifies the business center for adjustment of
    --   calculation period.
    deriving (Eq, Ord, Show)

-- | A data defining:  the parameters used in the
--   calculation of a fixed or floating rate calculation
--   period amount. This data forms:  part of cashflows
--   representation of a swap stream.
data CalculationPeriod = CalculationPeriod with 
  adjustedStartDate : Optional Date
    -- ^ The calculation period start date, adjusted according
    --   to any relevant business day convention.
  adjustedEndDate : Optional Date
    -- ^ The calculation period end date, adjusted according
    --   to any relevant business day convention.
  meta : Optional MetaFields
  unadjustedStartDate : Optional Date
    -- ^ The calculation start date, unadjusted.
  unadjustedEndDate : Optional Date
    -- ^ The calculation end date, unadjusted.
  calculationPeriodNumberOfDays : Optional Int
    -- ^ The number of days from the adjusted effective /
    --   start date to the adjusted termination / end date
    --   calculated in accordance with the applicable day
    --   count fraction.
  notionalAmount : Optional Decimal
    -- ^ The amount that a cashflow will accrue interest on.
  fxLinkedNotionalAmount : Optional FxLinkedNotionalAmount
    -- ^ The amount that a cashflow will accrue interest on.
    --   This is the calculated amount of the FX linked - i.e.
    --   the other currency notional amount multiplied by the
    --   appropriate FX spot rate.
  floatingRateDefinition : Optional FloatingRateDefinition
    -- ^ The floating rate reset information for the
    --   calculation period.
  fixedRate : Optional Decimal
    -- ^ The calculation period fixed rate. A per annum rate,
    --   expressed as a decimal. A fixed rate of 5% would be
    --   represented as 0.05.
  dayCountYearFraction : Optional Decimal
    -- ^ The year fraction value of the calculation period,
    --   result of applying the ISDA rules for day count
    --   fraction defined in the ISDA Annex.
  forecastAmount : Optional Money
    -- ^ The amount representing the forecast of the accrued
    --   value of the calculation period. An intermediate
    --   value used to generate the forecastPaymentAmount in
    --   the PaymentCalculationPeriod.
  forecastRate : Optional Decimal
    -- ^ A value representing the forecast rate used to
    --   calculate the forecast future value of the accrual
    --   period. This is a calculated rate determined based on
    --   averaging the rates in the rateObservation elements,
    --   and incorporates all of the rate treatment and
    --   averaging rules. A value of 1% should be represented
    --   as 0.01.
    deriving (Eq, Ord, Show)

-- | The calculation period adjusted start and end dates,
--   which are the baseline arguments needed to compute an
--   interest accrual calculation.
data CalculationPeriodBase = CalculationPeriodBase with 
  adjustedStartDate : Optional Date
    -- ^ The calculation period start date, adjusted according
    --   to any relevant business day convention.
  adjustedEndDate : Optional Date
    -- ^ The calculation period end date, adjusted according
    --   to any relevant business day convention.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

data CalculationPeriodData = CalculationPeriodData with 
  startDate : Date
  endDate : Date
  daysInPeriod : Int
  daysInLeapYearPeriod : Int
  isFirstPeriod : Bool
  isLastPeriod : Bool
    deriving (Eq, Ord, Show)

-- | A data for:  defining the parameters used to generate
--   the calculation period dates schedule, including the
--   specification of any initial or final stub
--   calculation periods. A calculation period schedule
--   consists of an optional initial stub calculation
--   period, one or more regular calculation periods and
--   an optional final stub calculation period. In the
--   absence of any initial or final stub calculation
--   periods, the regular part of the calculation period
--   schedule is assumed to be between the effective date
--   and the termination date. No implicit stubs are
--   allowed, i.e. stubs must be explicitly specified
--   using an appropriate combination of
--   firstPeriodStartDate, firstRegularPeriodStartDate and
--   lastRegularPeriodEndDate.
data CalculationPeriodDates = CalculationPeriodDates with 
  effectiveDate : Optional AdjustableOrRelativeDate
    -- ^ The first day of the terms of the trade. This day may
    --   be subject to adjustment in accordance with a
    --   business day convention.
  terminationDate : Optional AdjustableOrRelativeDate
    -- ^ The last day of the terms of the trade. This date may
    --   be subject to adjustments in accordance with the
    --   business day convention. It can also be specified in
    --   relation to another scheduled date (e.g. the last
    --   payment date).
  calculationPeriodDatesAdjustments : Optional BusinessDayAdjustments
    -- ^ The specification of the business day convention and
    --   financial business centers used for adjusting any
    --   calculation period date if it would otherwise fall on
    --   a day that is not a business day in the specified
    --   business center.
  firstPeriodStartDate : Optional AdjustableOrRelativeDate
    -- ^ The start date of the calculation period. FpML
    --   specifies that for interest rate swaps this date must
    --   only be specified if it is not equal to the effective
    --   date. It is always specified in the case of equity
    --   swaps and credit default swaps with periodic
    --   payments. This date may be subject to adjustment in
    --   accordance with a business day convention.
  firstRegularPeriodStartDate : Optional Date
    -- ^ The start date of the regular part of the calculation
    --   period schedule. It must only be specified if there
    --   is an initial stub calculation period. This day may
    --   be subject to adjustment in accordance with any
    --   adjustments specified in
    --   calculationPeriodDatesAdjustments.
  firstCompoundingPeriodEndDate : Optional Date
    -- ^ The end date of the initial compounding period when
    --   compounding is applicable. It must only be specified
    --   when the compoundingMethod element is present and not
    --   equal to a value of None. This date may be subject to
    --   adjustment in accordance with any adjustments
    --   specified in calculationPeriodDatesAdjustments.
  lastRegularPeriodEndDate : Optional Date
    -- ^ The end date of the regular part of the calculation
    --   period schedule. It must only be specified if there
    --   is a final stub calculation period. This day may be
    --   subject to adjustment in accordance with any
    --   adjustments specified in
    --   calculationPeriodDatesAdjustments.
  stubPeriodType : Optional StubPeriodTypeEnum
    -- ^ Method to allocate any irregular period remaining
    --   after regular periods have been allocated between the
    --   effective and termination date.
  calculationPeriodFrequency : Optional CalculationPeriodFrequency
    -- ^ The frequency at which calculation period end dates
    --   occur with the regular part of the calculation period
    --   schedule and their roll date convention.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A class to specify the frequency at which calculation
--   period end dates occur within the regular part of the
--   calculation period schedule and their roll date
--   convention.
data CalculationPeriodFrequency = CalculationPeriodFrequency with 
  periodMultiplier : Int
    -- ^ A time period multiplier, e.g. 1, 2, or 3. If the
    --   period value is T (Term) then period multiplier must
    --   contain the value 1.
  period : PeriodExtendedEnum
    -- ^ A time period, e.g. a day, week, month, year or term
    --   of the stream.
  meta : Optional MetaFields
  rollConvention : RollConventionEnum
    -- ^ The roll convention specifies the period term as part
    --   of a periodic schedule, i.e. the calculation period
    --   end date within the regular part of the calculation
    --   period. The value could be a rule, e.g. IMM
    --   Settlement Dates, which is the 3rd Wednesday of the
    --   month, or it could be a specific day of the month,
    --   such as the first day of the applicable month. It is
    --   used in conjunction with a frequency and the regular
    --   period start date of a calculation period.
  balanceOfFirstPeriod : Optional Bool
    -- ^ Indicates, when true, that that the first Calculation
    --   Period should run from the Effective Date to the end
    --   of the calendar period in which the Effective Date
    --   falls, e.g. Jan 15 - Jan 31 if the calculation
    --   periods are one month long and Effective Date is Jan
    --   15. If false, the first Calculation Period should run
    --   from the Effective Date for one whole period, e.g.
    --   Jan 15 to Feb 14 if the calculation periods are one
    --   month long and Effective Date is Jan 15. Mostly used
    --   in Commmodity Swaps.
    deriving (Eq, Ord, Show)

-- | A class that allows the full representation of a
--   payout by defining a set of schedule periods. It
--   supports standard schedule customization by
--   expressing all the dates, quantities, and pricing
--   data in a non-parametric way.
data CalculationSchedule = CalculationSchedule with 
  schedulePeriod : [SchedulePeriod]
    -- ^ Defines a period of a calculation schedule structure.
    deriving (Eq, Ord, Show)

-- | Period and time profile over which the delivery takes
--   place.
data CalculationScheduleDeliveryPeriods = CalculationScheduleDeliveryPeriods with 
  profile : [AssetDeliveryProfile]
    -- ^ Defines the delivery profile of the asset, including
    --   the load type and the delivery intervals.
  startDate : Optional Date
    -- ^ Delivery start date
  endDate : Optional Date
    -- ^ Delivery end date
  deliveryCapacity : Optional Quantity
    -- ^ The number of units included in the transaction for
    --   each delivery interval
  priceTimeIntervalQuantity : Optional Price
    -- ^ Price per quantity per delivery time interval.
    deriving (Eq, Ord, Show)

-- | A type for defining a calendar spread feature.
data CalendarSpread = CalendarSpread with 
  expirationDateTwo : AdjustableOrRelativeDate
    deriving (Eq, Ord, Show)

-- | A data defining:  the right of a party to cancel a
--   swap transaction on the specified exercise dates. The
--   provision is for 'walk-away' cancellation
--   (i.e. the fair value of the swap is not paid). A fee
--   payable on exercise can be specified. As a difference
--   from the FpML construct, the canonical model extends
--   the BuyerSeller class.
data CancelableProvision = CancelableProvision with 
  buyer : CounterpartyRoleEnum
    -- ^ Buyer party that can be resolved as one of the two
    --   principal parties to the transaction. The party that
    --   buys this instrument, i.e. pays for this instrument
    --   and receives the rights defined by it. ISDA 2002
    --   Equity Definitions section 1.18: `Buyer` means the
    --   party specified as such in the related Confirmation.
    --   | ISDA 2006 Definitions article 12.1 (b)(i) relating
    --   to a Swaption: 'Buyer' means the party that
    --   will, on each Premium Payment Date, pay to Seller the
    --   Premium | ISDA 2006 Definitions article 12.1 (b)(ii)
    --   relating to Swap Transactions with applicable Early
    --   Termination: the party specified as such in the
    --   related Confirmation, or the Exercising Party if
    --   neither party is specified | ISDA 2006 Definitions
    --   article 12.1 (b)(iii) relating to any other Option
    --   Transaction: the party specified as such in the
    --   related Confirmation. | ISDA 2014 Credit Definition
    --   article 1.4: `Buyer` means the Fixed Rate Payer.
  seller : CounterpartyRoleEnum
    -- ^ Seller party that can be resolved as one of the two
    --   principal parties to the transaction. The party that
    --   sells ('writes') this instrument, i.e. that
    --   grants the rights defined by this instrument and in
    --   return receives a payment for it. ISDA 2002 Equity
    --   Definitions section 1.19: `Seller` means the party
    --   specified as such in the related Confirmation. | ISDA
    --   2006 Definitions article 12.1 (a)(i) relating to a
    --   Swaption: 'Seller' means the party the party
    --   specified as such or as writer in the related
    --   Confirmation | ISDA 2006 Definitions article 12.1
    --   (a)(ii) relating to Swap Transactions with applicable
    --   Early Termination: the party specified as such or as
    --   writer in the related Confirmation or, if neither
    --   party is specified as such, the Non-exercising Party
    --   | ISDA 2006 Definitions article 12.1 (a)(iii)
    --   relating to any other Option Transaction: the party
    --   specified as such in the related Confirmation. | ISDA
    --   2014 Credit Definition article 1.4: `Seller` means
    --   the Floating Rate Payer.
  exerciseNotice : Optional ExerciseNotice
    -- ^ Definition of the party to whom notice of exercise
    --   should be given.
  followUpConfirmation : Bool
    -- ^ A flag to indicate whether follow-up confirmation of
    --   exercise (written or electronic) is required
    --   following telephonic notice by the buyer to the
    --   seller or seller's agent.
  cancelableProvisionAdjustedDates : Optional CancelableProvisionAdjustedDates
    -- ^ The adjusted dates associated with a cancelable
    --   provision. These dates have been adjusted for any
    --   applicable business day convention.
  finalCalculationPeriodDateAdjustment : [FinalCalculationPeriodDateAdjustment]
    -- ^ Business date convention adjustment to final payment
    --   period per leg (swapStream) upon exercise event. The
    --   adjustments can be made in-line with leg level
    --   BDC's or they can be specified separately.
  initialFee : Optional Transfer
    -- ^ An initial fee for the cancelable option.
  callingParty : Optional CallingPartyEnum
    -- ^ The party with right to exercise a cancellation.
    --   Allows for buyer, seller or either.
  earliestDate : Optional AdjustableOrRelativeDate
    -- ^ The first day when cancelation is permitted to take
    --   effect. A party may give notice prior to this date
    --   and taken together with the effective period would be
    --   necessary to cancel on this date.
  expirationDate : Optional AdjustableOrRelativeDate
    -- ^ The last day within the term of the contract that
    --   cancelation is allowed.
  effectiveDate : Optional AdjustableOrRelativeDates
    -- ^ The effective date if cancelation is invoked
    --   otherwise the cancellation period defines the
    --   cancellation date.
  effectivePeriod : Optional Period
    -- ^ Effective period for cancelation when notice is
    --   given. This is the period after notice is given that
    --   cancellation becomes effecticve.
  earliestCancellationTime : Optional BusinessCenterTime
    -- ^ The earliest time in a business day that notice of
    --   cancelation can be given.
  latestCancelationTime : Optional BusinessCenterTime
    -- ^ The latest time at which notice of cancelation can be
    --   given.
  exerciseTerms : ExerciseTerms
    -- ^ The exercise terms associated with the cancelable
    --   provision, including details such as exercise style,
    --   exercise fees, and any other relevant conditions or
    --   terms governing the cancellation of the swap
    --   transaction.
    deriving (Eq, Ord, Show)

-- | A data to:  define the adjusted dates for a
--   cancelable provision on a swap transaction.
data CancelableProvisionAdjustedDates = CancelableProvisionAdjustedDates with 
  cancellationEvent : [CancellationEvent]
    -- ^ The adjusted dates for an individual cancellation
    --   date.
    deriving (Eq, Ord, Show)

-- | The adjusted dates for a specific cancellation date,
--   including the adjusted exercise date and adjusted
--   termination date.
data CancellationEvent = CancellationEvent with 
  adjustedExerciseDate : Date
    -- ^ The date on which option exercise takes place. This
    --   date should already be adjusted for any applicable
    --   business day convention.
  adjustedEarlyTerminationDate : Date
    -- ^ The early termination date that is applicable if an
    --   early termination provision is exercised. This date
    --   should already be adjusted for any applicable
    --   business day convention.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | An Asset that consists solely of a monetary holding
--   in a currency. The currency of the Cash asset is held
--   in the string Identifier (from AssetBase) and the
--   AssetIdTypeEnum must be set to define that a
--   CurrencyCode is set.  The function SetCashCurrency
--   can be used to create (or update) a Cash object and
--   the function GetCashCurrency can be used to retrieve
--   the currency of a Cash object.
data Cash = Cash with 
  identifier : [AssetIdentifier]
    -- ^ Asset Identifiers are used to uniquely identify an
    --   Asset, using a specified Asset Identifier Type.
  taxonomy : [Taxonomy]
    -- ^ Defines the taxonomy of an object by combining a
    --   taxonomy source (i.e. the rules to classify the
    --   object) and a value (i.e. the output of those rules
    --   on the object.
  isExchangeListed : Optional Bool
    -- ^ Defines whether the Asset is listed on a public
    --   exchange.
  exchange : Optional LegalEntity
    -- ^ If the Asset is listed, defines the public exchange
    --   of the listing.
  relatedExchange : [LegalEntity]
    -- ^ Provides the related Exchanges, if applicable.
    deriving (Eq, Ord, Show)

-- | This type is a generic structure that can represent
--   the parameters of several mid-market valuation and
--   replacement value methods described in the 2021 ISDA
--   Definitions.
data CashCollateralValuationMethod = CashCollateralValuationMethod with 
  applicableCsa : Optional CsaTypeEnum
    -- ^ This may be used to specify what type of CSA (credit
    --   support annex/agreement) is to be used for cash
    --   settlement purposes.
  cashCollateralCurrency : Optional Text
    -- ^ This may be used to indicate the currency of cash
    --   collateral for cash settlement purposes.
  cashCollateralInterestRate : Optional (FieldWithMeta Text)
    -- ^ This may be used to indicate the interest rate to be
    --   used for cash collateral for cash settlement
    --   purposes.
  agreedDiscountRate : Optional (FieldWithMeta Text)
    -- ^ This may be used to indicate the discount rate to be
    --   used for cash collateral for cash settlement
    --   purposes.
  protectedParty : [PartyDeterminationEnum]
    -- ^ This may be used to specify which party is protected
    --   (e.g. under Replacement Value cash settlement
    --   methods).
  prescribedDocumentationAdjustment : Optional Bool
    -- ^ This may be used to indicate that 'prescribed
    --   documentation adjustment' is applicable.
    deriving (Eq, Ord, Show)

-- | Specifies the nature of a cash price either as a fee
--   type, cash price type, or premium expression.
data CashPrice = CashPrice with 
  cashPriceType : CashPriceTypeEnum
    -- ^ Specifies the type of Cash Price.
  premiumExpression : Optional PremiumExpression
    -- ^ Specifies a premium when expressed in a way other
    --   than an amount, and any required forward starting
    --   price definition.
  feeType : Optional FeeTypeEnum
    -- ^ Specifies the event type associated with a fee.
    deriving (Eq, Ord, Show)

-- | Defines the terms required to compute and settle a
--   cash settlement amount according to a fixing value,
--   including the fixing source, fixing method and fixing
--   date. In FpML, PhysicalSettlementTerms and
--   CashSettlementTerms extend SettlementTerms. In the
--   CDM, this extension paradigm has not been used
--   because SettlementTerms class has been used for
--   purposes related to securities transactions, while it
--   is not used as such in the FpML standard (i.e. only
--   as an abstract construct.
data CashSettlementTerms = CashSettlementTerms with 
  cashSettlementMethod : Optional CashSettlementMethodEnum
    -- ^ Specifies the type of cash settlement method: cash
    --   price, yield curve etc.
  valuationMethod : Optional ValuationMethod
    -- ^ Specifies the parameters required to obtain a
    --   valuation, including the source, quotation method
    --   (bid, mid etc.) and any applicable quotation amount.
  valuationDate : Optional ValuationDate
    -- ^ Defines the different methods to specify a valuation
    --   date, as used for cash settlement. The Single /
    --   Multiple ValuationDate is used for the determination
    --   of recovery in a credit event, the RelativeDateOffset
    --   is used for cash-settled option, and FxFixingDate is
    --   used for cross-currency settlement.
  valuationTime : Optional BusinessCenterTime
    -- ^ The time of the cash settlement valuation date when
    --   the cash settlement amount will be determined
    --   according to the cash settlement method, if the
    --   parties have not otherwise been able to agree the
    --   cash settlement amount. When using quations, this is
    --   the time of day in the specified business center when
    --   the calculation agent seeks quotations for an amount
    --   of the reference obligation for purposes of cash
    --   settlement. ISDA 2003 Term: Valuation Time.
  cashSettlementAmount : Optional Money
    -- ^ The amount paid by the seller to the buyer for cash
    --   settlement on the cash settlement date. If not
    --   otherwise specified, would typically be calculated as
    --   100 (or the Reference Price) minus the price of the
    --   Reference Obligation (all expressed as a percentage)
    --   times Floating Rate Payer Calculation Amount. ISDA
    --   2003 Term: Cash Settlement Amount.
  recoveryFactor : Optional Decimal
    -- ^ Used for fixed recovery, specifies the recovery
    --   level, determined at contract formation, to be
    --   applied on a default. Used to calculate the amount
    --   paid by the seller to the buyer for cash settlement
    --   on the cash settlement date. Amount calculation is (1
    --   minus the Recovery Factor) multiplied by the Floating
    --   Rate Payer Calculation Amount. The currency will be
    --   derived from the Floating Rate Payer Calculation
    --   Amount.
  fixedSettlement : Optional Bool
    -- ^ Used for Recovery Lock, to indicate whether fixed
    --   Settlement is Applicable or Not Applicable. If Buyer
    --   fails to deliver an effective Notice of Physical
    --   Settlement on or before the Buyer NOPS Cut-off Date,
    --   and if Seller fails to deliver an effective Seller
    --   NOPS on or before the Seller NOPS Cut-off Date, then
    --   either: (a) if Fixed Settlement is specified in the
    --   related Confirmation as not applicable, then the
    --   Seller NOPS Cut-off Date shall be the Termination
    --   Date; or (b) if Fixed Settlement is specified in the
    --   related Confirmation as applicable, then: (i) if the
    --   Fixed Settlement Amount is a positive number, Seller
    --   shall, subject to Section 3.1 (except for the
    --   requirement of satisfaction of the Notice of Physical
    --   Settlement Condition to Settlement), pay the Fixed
    --   Settlement Amount to Buyer on the Fixed Settlement
    --   Payment Date; and (ii) if the Fixed Settlement Amount
    --   is a negative number, Buyer shall, subject to Section
    --   3.1 (except for the requirement of satisfaction of
    --   the Notice of Physical Settlement Condition to
    --   Settlement), pay the absolute value of the Fixed
    --   Settlement Amount to Seller on the Fixed Settlement
    --   Payment Date.
  accruedInterest : Optional Bool
    -- ^ Indicates whether accrued interest is included (true)
    --   or not (false). For cash settlement this specifies
    --   whether quotations should be obtained inclusive or
    --   not of accrued interest. For physical settlement this
    --   specifies whether the buyer should deliver the
    --   obligation with an outstanding principal balance that
    --   includes or excludes accrued interest. ISDA 2003
    --   Term: Include/Exclude Accrued Interest.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | Class to specify a cashflow, i.e. the outcome of
--   either of computation (e.g. interest accrual) or an
--   assessment of some sort (e.g. a fee). The cashflow
--   can then be turned into a cash transfer, artefact to
--   be used as the input to a payment system or the
--   outcome of it. The associated globalKey denotes the
--   ability to associate a hash value to the Cashflow
--   instantiations for the purpose of model
--   cross-referencing, in support of functionality such
--   as the event effect and the lineage.
data Cashflow = Cashflow with 
  payerReceiver : PayerReceiver
    -- ^ Canonical representation of the payer and receiver
    --   parties applicable to each payout leg.
  priceQuantity : Optional ResolvablePriceQuantity
    -- ^ Each payout leg must implement the quantity concept
    --   as a 'resolvable' type, which allows for
    --   different payout legs to be linked to each other
    --   (e.g. in the case of cross-curreny products).
  principalPayment : Optional PrincipalPayments
    -- ^ The specification of the principal exchange. Optional
    --   as only applicable in the case of cross-currency or
    --   zero-coupon swaps with a final payment.
  settlementTerms : Optional SettlementTerms
    -- ^ Each payout leg must specifies its settlement terms,
    --   including the delivery type (i.e. cash vs physical,
    --   and their respective terms), the transfer type (DvP
    --   etc.) and settlement date, if any.
  cashflowType : CashflowType
    -- ^ The qualification of the type of cashflow, e.g.
    --   brokerage fee, premium, upfront fee etc. Particularly
    --   relevant when it cannot be inferred directly through
    --   lineage.
  paymentDiscounting : Optional PaymentDiscounting
    -- ^ FpML specifies the FpML PaymentDiscounting.model
    --   group for representing the discounting elements that
    --   can be associated with a payment.
    deriving (Eq, Ord, Show)

-- | A data defining:  the cashflow representation of a
--   swap trade.
data CashflowRepresentation = CashflowRepresentation with 
  cashflowsMatchParameters : Bool
    -- ^ A true/false flag to indicate whether the cashflows
    --   match the parametric definition of the stream, i.e.
    --   whether the cashflows could be regenerated from the
    --   parameters without loss of information.
  paymentCalculationPeriod : [PaymentCalculationPeriod]
    -- ^ The adjusted payment date and associated calculation
    --   period parameters required to calculate the actual or
    --   projected payment amount. A list of payment
    --   calculation period elements may be ordered in the
    --   document by ascending adjusted payment date. An FpML
    --   document containing an unordered list of payment
    --   calculation periods is still regarded as a conformant
    --   document.
    deriving (Eq, Ord, Show)

-- | Characterises the type of cashflow, which can result
--   from either a scheduled or a non-scheduled lifecycle
--   event.
data CashflowType = CashflowType with 
  cashflowType : Optional ScheduledTransferEnum
    -- ^ Type of cashflow corresponding to a scheduled event.
  cashPrice : Optional CashPrice
    -- ^ Type of cashflow corresponding to a non-scheduled
    --   event, where a price must be agreed between the
    --   parties.
  priceExpression : Optional PriceExpressionEnum
    deriving (Eq, Ord, Show)

-- | Result for the CheckEligibilityByDetails and
--   CheckEligibilityForProduct functions
data CheckEligibilityResult = CheckEligibilityResult with 
  isEligible : Bool
    -- ^ a simple boolean which is set to true if the asset
    --   described in the EligibilityQuery input is eligible
  matchingEligibleCriteria : [EligibleCollateralCriteria]
    -- ^ if there was a match, this will be the one or more
    --   criteria that were supplied in the
    --   EligbilityCollateralSpecification which matched with
    --   the query input
  eligibilityQuery : EligibilityQuery
    -- ^ a copy of the input query that was checked against
    --   the eligible collateral specification
  specification : EligibleCollateralSpecification
    -- ^ a copy of the input EligbilityCollateralSpecification
    --   that was checked against the query
    deriving (Eq, Ord, Show)

-- | A type for documenting additional clause that cannot
--   yet be represented with the model and yet needed for
--   a digital representation of the agreement
data Clause = Clause with 
  identifier : Optional Text
    -- ^ The  name or identifier associated to this clause 
  terms : Optional Text
    -- ^ Content of this bespoke clause
  subcomponents : [Clause]
    -- ^ Additional hierarchichal components of the clause if
    --   relevant
    deriving (Eq, Ord, Show)

-- | All information required to perform the clear life
--   cycle event; the clearing party (CCP), the two
--   parties facing each other on the alpha contract, and
--   optionally the parties acting as clearing members.
data ClearingInstruction = ClearingInstruction with 
  alphaContract : TradeState
    -- ^ The contract that will be submitted to the clearing
    --   house for clearing. The contract should indicate that
    --   it should be cleared by assigning a clearing
    --   organisation as a party role.
  clearingParty : Party
    -- ^ The Central Counter party (CCP) that the contract
    --   will be submitted to for clearing.
  party1 : Party
    -- ^ First party facing the CCP if it is clearing for its
    --   own account.
  party2 : Party
    -- ^ Second party facing the CCP if it is clearing for its
    --   own account.
  clearerParty1 : Optional Party
    -- ^ Optional party facing the CCP, acting as clearing
    --   member for party1.
  clearerParty2 : Optional Party
    -- ^ Optional party facing the CCP, acting as clearing
    --   member for party2.
  isOpenOffer : Optional Bool
    -- ^ Open Offer
    deriving (Eq, Ord, Show)

-- | A class to qualify the closed state of an execution
--   or a contract through the combination or a state
--   (e.g. terminated, novated) and a set of dates:
--   activity date, effective date and, when relevant,
--   last payment date.
data ClosedState = ClosedState with 
  state : ClosedStateEnum
    -- ^ The qualification of what gave way to the contract or
    --   execution closure, e.g. allocation, termination, ...
  activityDate : Date
    -- ^ The activity date on which the closing state took
    --   place, i.e. either the event date of the closing
    --   event (e.g. option exercise, contract early
    --   termination) or the contractual termination date.
  effectiveDate : Optional Date
    -- ^ The date on which the closing event contractually
    --   takes effect, when different from the activity date.
    --   When an explicit event effective date attribute is
    --   associated with the closing event, it will be that
    --   date. In the case of a cancellation event, it will be
    --   the date on which the cancelled event took place.
  lastPaymentDate : Optional Date
    -- ^ The date associated with the last payment in relation
    --   to the artefact (e.g. contract) to which this closed
    --   state applies. As an example, in the case of an early
    --   termination event, it would be the settlement date of
    --   the associated fee, if applicable.
    deriving (Eq, Ord, Show)

-- | A type for defining the obligations of the
--   counterparty subject to credit support requirements.
data Collateral = Collateral with 
  independentAmount : Optional IndependentAmount
    -- ^ Independent Amount is an amount that usually less
    --   creditworthy counterparties are asked to provide. It
    --   can either be a fixed amount or a percentage of the
    --   Transaction's value. The Independent Amount can
    --   be: (i) transferred before any trading between the
    --   parties occurs (as a deposit at a third party's
    --   account or with the counterparty) or (ii) callable
    --   after trading has occurred (typically because a
    --   downgrade has occurred). In situation (i), the
    --   Independent Amount is not included in the calculation
    --   of Exposure, but in situation (ii), it is included in
    --   the calculation of Exposure. Thus, for situation
    --   (ii), the Independent Amount may be transferred along
    --   with any collateral call. Independent Amount is a
    --   defined term in the ISDA Credit Support Annex.
    --   ('with respect to a party, the amount specified
    --   as such for that party in Paragraph 13; if no amount
    --   is specified, zero').
  portfolioIdentifier : [Identifier]
    -- ^ A list of identifiers pointing to the collateral
    --   portfolios which contain the collateral which covers
    --   a trade.
  collateralPortfolio : [ReferenceWithMeta CollateralPortfolio]
    -- ^ The collateral portfolios which contain the
    --   collateral which covers a trade. (NB: this can be
    --   provided by reference to a global key for each
    --   CollateralPortfolio object)
  collateralProvisions : Optional CollateralProvisions
    -- ^ specifies the collateral provisions of the product.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | Represents the parameters needed to calculate the
--   floating rate paid on collateral holdings.
data CollateralAgreementFloatingRate = CollateralAgreementFloatingRate with 
  rateOption : Optional (ReferenceWithMeta FloatingRateIndex)
  spreadSchedule : Optional SpreadSchedule
    -- ^ The ISDA Spread or a Spread schedule expressed as
    --   explicit spreads and dates. In the case of a
    --   schedule, the step dates may be subject to adjustment
    --   in accordance with any adjustments specified in
    --   calculationPeriodDatesAdjustments. The spread is a
    --   per annum rate, expressed as a decimal. For purposes
    --   of determining a calculation period amount, if
    --   positive the spread will be added to the floating
    --   rate and if negative the spread will be subtracted
    --   from the floating rate. A positive 10 basis point
    --   (0.1%) spread would be represented as 0.001.
  capRateSchedule : Optional StrikeSchedule
    -- ^ The cap rate or cap rate schedule, if any, which
    --   applies to the floating rate. The cap rate (strike)
    --   is only required where the floating rate on a swap
    --   stream is capped at a certain level. A cap rate
    --   schedule is expressed as explicit cap rates and dates
    --   and the step dates may be subject to adjustment in
    --   accordance with any adjustments specified in
    --   calculationPeriodDatesAdjustments. The cap rate is
    --   assumed to be exclusive of any spread and is a per
    --   annum rate, expressed as a decimal. A cap rate of 5%
    --   would be represented as 0.05.
  floorRateSchedule : Optional StrikeSchedule
    -- ^ The floor rate or floor rate schedule, if any, which
    --   applies to the floating rate. The floor rate (strike)
    --   is only required where the floating rate on a swap
    --   stream is floored at a certain strike level. A floor
    --   rate schedule is expressed as explicit floor rates
    --   and dates and the step dates may be subject to
    --   adjustment in accordance with any adjustments
    --   specified in calculationPeriodDatesAdjustments. The
    --   floor rate is assumed to be exclusive of any spread
    --   and is a per annum rate, expressed as a decimal. A
    --   floor rate of 5% would be represented as 0.05.
  meta : Optional MetaFields
  negativeInterest : Bool
    -- ^ Specifies how negative rates should be applied.  If
    --   rates go negative, should the payment be reversed
    --   (true) or zeroed out (false)?
  compressibleSpread : Bool
    -- ^ Specifies how spreads should be applied in a
    --   low/negative rate environment.  If true, spread is
    --   applied only if rate is positive.
    deriving (Eq, Ord, Show)

-- | Represents common attributes to define a collateral
--   balance recorded by the principal as held or posted.
data CollateralBalance = CollateralBalance with 
  collateralBalanceStatus : Optional CollateralStatusEnum
    -- ^ Defines the collateral balance breakdown of
    --   settlement status.
  haircutIndicator : Optional HaircutIndicatorEnum
    -- ^ Indicates if the collateral balance amount is based
    --   on pre or post haircut, if a haircut is associated
    --   with the collateral asset
  amountBaseCurrency : Money
    -- ^ Specifies the collateral balance amount in base
    --   currency determined within a collateral legal
    --   agreement, or defined for reporting purposes.
  payerReceiver : PartyReferencePayerReceiver
    -- ^ Specifies each of the parties in the collateral
    --   balance and its perspective with regards to the
    --   direction of the collateral balance, posted or
    --   received.
    deriving (Eq, Ord, Show)

-- | Represents a set of criteria used to specify and
--   describe collateral.
data CollateralCriteriaBase = CollateralCriteriaBase with 
  issuer : [IssuerCriteria]
    -- ^ Represents a filter based criteria related to the
    --   issuer.
  asset : [AssetCriteria]
    -- ^ Represents a filter based on the criteria related to
    --   the asset.
  appliesTo : [CounterpartyRoleEnum]
    -- ^ Specifies which of the two counterparties the
    --   criteria applies to (either one or both
    --   counterparties). This attribute is optional, in case
    --   the applicable party is already specified elsewhere
    --   within a party election.
  restrictTo : Optional CollateralMarginTypeEnum
    -- ^ Restrict the criteria to only apply to a specific
    --   type of margin, ie IM or VM.
  ratingPriorityResolution : Optional RatingPriorityResolutionEnum
    -- ^ Denotes which Criteria has priority if more than one
    --   agency rating applies.
    deriving (Eq, Ord, Show)

-- | Represents parameters for calculating the amount the
--   floating interest calculation, e.g.  for a single
--   currency or defaults for all currencies.
data CollateralInterestCalculationParameters = CollateralInterestCalculationParameters with 
  fixedRate : Optional Decimal
    -- ^ Specifies the applicable fixed rate  if used.
  floatingRate : Optional CollateralAgreementFloatingRate
    -- ^ Specifies the floating interest rate to be used.
  inBaseCurrency : Bool
    -- ^ If True, specifies that the interest transfers should
    --   be converted to base currency equivalent, or if False
    --   specifies that the transfer should be in the currency
    --   of the collateral.
  compoundingType : Optional CompoundingTypeEnum
    -- ^ Specifies the type of compounding to be applied
    --   (None, Business, Calendar).
  compoundingBusinessCenter : [BusinessCenterEnum]
    -- ^ Specifies the applicable business centers for
    --   compounding.
  dayCountFraction : DayCountFractionEnum
    -- ^ Specifies the day count fraction to use for that
    --   currency.
  rounding : Optional Rounding
    -- ^ Specifies the rounding rules for settling in that
    --   currency.
  roundingFrequency : Optional RoundingFrequencyEnum
    -- ^ Specifies when/how often is rounding applied?
  withholdingTaxRate : Optional Decimal
    -- ^ Specifies the withholding tax rate if a withholding
    --   tax is applicable.
    deriving (Eq, Ord, Show)

-- | Represents parameters that describe how calculated
--   interest amounts are handled, i.e. are they
--   transferred/distributed, or is the collateral balance
--   adjusted, is netting done, and any other special
--   handling.
data CollateralInterestHandlingParameters = CollateralInterestHandlingParameters with 
  interestPaymentHandling : CollateralInterestHandlingEnum
    -- ^ Specifies how the collateral interest is to be
    --   handled.
  paymentBusinessCenter : [BusinessCenterEnum]
    -- ^ Specifies applicable business centers for payments.
  netPostedAndHeldInterest : Bool
    -- ^ Indicates whether to net Held and Posted Interest
    --   Payments (i.e. whether interest payable for a period
    --   can be netted with interest receivable).
  netInterestWithMarginCalls : Bool
    -- ^ Indicates whether the interest amount may be offset
    --   against any margin call deliver or return amounts?  
    --   (aka 'net payments' indicator).
  includeAccrualInMarginCalc : Bool
    -- ^ Indicates whether or not to include the open interest
    --   accrual in the margin calculation.
  accrueInterestOnUnsettledInterest : Optional Bool
    -- ^ Indicates whether interest accruing on unsettled
    --   interest amount is included (continues to be accrued)
    --   in the following period.
  onFullReturn : Bool
    -- ^ Indicates the option that accrued interest should be
    --   calculated and distributed when a full return of
    --   collateral occurs.
  onPartialReturn : Bool
    -- ^ Indicates the option that accrued interest should be
    --   calculated and distributed when a partial return
    --   collateral occurs.
  interestAmountApplication : Optional InterestAmountApplication
    -- ^ The application of Interest Amount with respect to
    --   the Delivery Amount and the Return Amount.
  interestRolloverLimit : Optional NumberBound
    -- ^ Specifies the level below which the interest will be
    --   rolled over.
  writeoffLimit : Optional NumberBound
    -- ^ Specifies the level below which the interest will be
    --   written off; if omitted write-off is not applicable.
  alternativeToInterestAmount : Optional AlternativeToInterestAmountEnum
    -- ^ Specifies the alternative to interest amounts.
  alternativeProvision : Optional Text
    -- ^ Specifies an alternative to interest amount, when the
    --   alternative provision clause is specified.
  cutoffTime : Optional Text
    -- ^ Specifies the time of day that interest needs to be
    --   confirmed by.
  notification : Optional CollateralInterestNotification
    -- ^ Specifies the terms describing notification
    --   requirements.
    deriving (Eq, Ord, Show)

-- | Represents the parameters describing when
--   notifications should be made for required collateral
--   interest transfers.
data CollateralInterestNotification = CollateralInterestNotification with 
  trigger : Text
    -- ^ Specifies what triggers notification (should be enum)
    --   Interest Statement Frequency, Period End Date.
  offset : Decimal
    -- ^ Specifies the number of days before (negative) or
    --   after (positive) the trigger event.
  notificationTime : Text
    -- ^ Specifies the time of day that the notification
    --   should occur.
  notificationDayType : DayTypeEnum
    -- ^ The type of days on which notification should occur.
    deriving (Eq, Ord, Show)

-- | Represents the floating interest calculation and
--   distribution parameters for a single currency.
data CollateralInterestParameters = CollateralInterestParameters with 
  postingParty : Optional CounterpartyRoleEnum
    -- ^ Represents the party to which these parameters apply
    --   (the applicable party).  In other words, if the
    --   parameters are different depending on which party is
    --   posting/holding the collateral, for which party to
    --   the Collateral Agreement (Party 1 or Party 2) that is
    --   posting the collateral do these parameters apply?
  marginType : Optional CollateralMarginTypeEnum
    -- ^ Specifies the type of margin for which interest is
    --   being calculated, if the parameters are different
    --   depending on type of margin (initial or variation).
  currency : Optional Text
    -- ^ Specifies the currency for which the parameters are
    --   captured.
  interestCalculationParameters : Optional CollateralInterestCalculationParameters
    -- ^ Represents the basic interest calculation parameters.
  interestCalculationFrequency : Optional CalculationFrequency
    -- ^ Represents how often and when interest is calculated.
  interestHandlingParameters : Optional CollateralInterestHandlingParameters
    -- ^ Represents the parameters describing how and when
    --   interest transfer occurs.
    deriving (Eq, Ord, Show)

-- | Represents a class to allow specification of the type
--   of entity issuing the collateral.
data CollateralIssuerType = CollateralIssuerType with 
  issuerType : IssuerTypeEnum
    -- ^ Specifies the origin of entity issuing the
    --   collateral.
  supraNationalType : Optional SupraNationalIssuerTypeEnum
    -- ^ Specifies debt issued by international organisations
    --   and multilateral banks.
  quasiGovernmentType : Optional QuasiGovernmentIssuerType
    -- ^ Specifies debt issues by institutions or bodies,
    --   typically constituted by statute, with a function
    --   mandated by the government and subject to government
    --   supervision inclusive of profit- and non-profit
    --   making bodies. Includes the US Agencies and GSEs and
    --   the EU concept of public sector entities. Excluding
    --   any entities which are also Regional Government.
  regionalGovernmentType : Optional RegionalGovernmentIssuerType
    -- ^ Specifies Regional government, local authority or
    --   municipal.
  specialPurposeVehicleType : Optional SpecialPurposeVehicleIssuerType
    -- ^ Specifies a subsidiary company that is formed to
    --   undertake a specific business purpose of acquisition
    --   and financing of specific assets on a potentially
    --   limited recourse basis dependent of how it is
    --   designed. E.g. asset backed securities, including
    --   securitisations.
    deriving (Eq, Ord, Show)

-- | Represents common attributes to define the details of
--   collateral assets, to be used in margin call
--   messaging and contribute to collateral balances e.g
--   securities in a collateral account.
data CollateralPortfolio = CollateralPortfolio with 
  portfolioIdentifier : Optional Identifier
    -- ^ Specifies a unique identifier for a set of collateral
    --   positions in a portfolio.
  collateralPosition : [CollateralPosition]
    -- ^ Specifies the individual components of the collateral
    --   positions in the collateral portfolio.
  collateralBalance : [CollateralBalance]
    -- ^ Represents the populated or calculated collateral
    --   aggregate balance amount for the collateral
    --   portfolio.
  legalAgreement : Optional (ReferenceWithMeta LegalAgreement)
    -- ^ The specification of a legal agreement between two
    --   parties governing the collateral relationship such as
    --   Credit Support Agreement or Collateral Transfer
    --   Agreement etc. (NB: this can be provided by reference
    --   to a global key for each LegalAgreement object).
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | Specifies the individual components of collateral
--   positions.
data CollateralPosition = CollateralPosition with 
  priceQuantity : [PriceQuantity]
    -- ^ Position with many price quantities.
  product : Product
    -- ^ The product underlying the position.
  cashBalance : Optional Money
    -- ^ The aggregate cost of proceeds
  tradeReference : Optional (ReferenceWithMeta TradeState)
    -- ^ Reference to the Contract, in case product is
    --   contractual and the contract has been formed
  treatment : Optional CollateralTreatment
    -- ^ Specifies if there is any treatment to be applied to
    --   collateral, such as percentage discount which will
    --   impact collateral value.
  collateralPositionStatus : Optional CollateralStatusEnum
    -- ^ Indicates the collateral positions settlement status.
    deriving (Eq, Ord, Show)

-- | Contains collateral attributes which can also inherit
--   information from a GMRA
data CollateralProvisions = CollateralProvisions with 
  collateralType : CollateralTypeEnum
    -- ^ Enumerates the collateral types which are accepted by
    --   the Seller.
  eligibleCollateral : [EligibleCollateralCriteria]
    -- ^ The eligible collateral as specified in relation to
    --   the transaction.
  substitutionProvisions : Optional SubstitutionProvisions
    -- ^ The provisions for collateral substitutions such as
    --   how many and when they are allowed.
    deriving (Eq, Ord, Show)

-- | Specifies the collateral taxonomy, which is composed
--   of a taxonomy value and a taxonomy source.
data CollateralTaxonomy = CollateralTaxonomy with 
  taxonomyValue : CollateralTaxonomyValue
    -- ^ Specifies the taxonomy value.
  taxonomySource : TaxonomySourceEnum
    -- ^ Specifies the taxonomy source.
    deriving (Eq, Ord, Show)

-- | Specifies the collateral taxonomy value, either as a
--   specified enumeration or as a string.
data CollateralTaxonomyValue = CollateralTaxonomyValue with 
  eu_EMIR_EligibleCollateral : [EU_EMIR_EligibleCollateralEnum]
    -- ^ Identifies European Union Eligible Collateral Assets
    --   classification categories based on EMIR Uncleared
    --   Margin Rules. Eligible Collateral asset classes for
    --   both initial margin (IM) and variation margin (VM)
    --   posted and collected between specified entities.
    --   Please note: EMIR regulation will detail which
    --   eligible collateral assets classes apply to each type
    --   of entity pairing (counterparty) and which apply to
    --   posting of IM and VM
  uk_EMIR_EligibleCollateral : [UK_EMIR_EligibleCollateralEnum]
    -- ^ Identifies United Kingdom Eligible Collateral Assets
    --   classification categories based on UK Onshored EMIR
    --   Uncleared Margin Rules Eligible Collateral asset
    --   classes for both initial margin (IM) and variation
    --   margin (VM) posted and collected between specified
    --   entities. Please note: UK EMIR regulation will detail
    --   which eligible collateral assets classes apply to
    --   each type of entity pairing (counterparty) and which
    --   apply to posting of IM and VM.
  us_CFTC_PR_EligibleCollateral : [US_CFTC_PR_EligibleCollateralEnum]
    -- ^ Identifies US Eligible Collateral Assets
    --   classification categories based on Uncleared Margin
    --   Rules published by the CFTC and the US Prudential
    --   Regulator. Note: While the same basic categories
    --   exist in the CFTC and US Prudential Regulators’
    --   margin rules, the precise definitions or application
    --   of those rules could differ between the two rules.
  nonEnumeratedTaxonomyValue : [FieldWithMeta Text]
    -- ^ Identifies the taxonomy value when not specified as
    --   an enumeration.
    deriving (Eq, Ord, Show)

-- | The set of elections which specify a Collateral
--   Transfer Agreement
data CollateralTransferAgreementElections = CollateralTransferAgreementElections with 
    deriving (Eq, Ord, Show)

-- | Specifies the treatment terms for the eligible
--   collateral criteria specified.
data CollateralTreatment = CollateralTreatment with 
  valuationTreatment : Optional CollateralValuationTreatment
    -- ^ Specification of the valuation treatment for the
    --   specified collateral.
  concentrationLimit : [ConcentrationLimit]
    -- ^ Specification of concentration limits applicable to
    --   the collateral criteria.
  isIncluded : Bool
    -- ^ A boolean attribute to specify whether collateral
    --   critieria are inclusion (True) or exclusion (False)
    --   criteria.
    deriving (Eq, Ord, Show)

-- | Specification of the valuation treatment for the
--   specified collateral.
data CollateralValuationTreatment = CollateralValuationTreatment with 
  haircutPercentage : Optional Decimal
    -- ^ Specifies a haircut percentage to be applied to the
    --   value of asset and used as a discount factor to the
    --   value of the collateral asset,expressed as a
    --   percentage in decimal terms. As an example a 0.5%
    --   haircut would be represented as a decimal number
    --   0.005.
  marginPercentage : Optional Decimal
    -- ^ Specifies a percentage value of transaction needing
    --   to be posted as collateral expressed as a valuation.
    --   As an example a 104% requirement would be represented
    --   as a decimal number 1.04.
  fxHaircutPercentage : Optional Decimal
    -- ^ Specifies an FX haircut applied to a specific asset
    --   which is agreed between the parties (for example, if
    --   pledgor eligible collateral is not denominated in the
    --   termination currency or under other specified cases
    --   in collateral support documents both for initial
    --   margin and variation margin).The percentage value is
    --   expressed as the discount haircut to the value of the
    --   collateral- as an example an 8% FX haircut would be
    --   expressed as 0.08.
  additionalHaircutPercentage : Optional Decimal
    -- ^ Specifies a percentage value of any additional
    --   haircut to be applied to a collateral asset,the
    --   percentage value is expressed as the discount haircut
    --   to the value of the collateral- as an example a 5%
    --   haircut would be expressed as 0.05. 
    deriving (Eq, Ord, Show)

-- | Identifies a specific commodity by referencing a
--   product identifier or by a product definition.
data Commodity = Commodity with 
  identifier : [AssetIdentifier]
    -- ^ Asset Identifiers are used to uniquely identify an
    --   Asset, using a specified Asset Identifier Type.
  taxonomy : [Taxonomy]
    -- ^ Defines the taxonomy of an object by combining a
    --   taxonomy source (i.e. the rules to classify the
    --   object) and a value (i.e. the output of those rules
    --   on the object.
  isExchangeListed : Optional Bool
    -- ^ Defines whether the Asset is listed on a public
    --   exchange.
  exchange : Optional LegalEntity
    -- ^ If the Asset is listed, defines the public exchange
    --   of the listing.
  relatedExchange : [LegalEntity]
    -- ^ Provides the related Exchanges, if applicable.
  commodityProductDefinition : Optional CommodityProductDefinition
    -- ^ Specifies the commodity underlier in the event that
    --   no ISDA Commodity Reference Benchmark exists.
  priceQuoteType : QuotationSideEnum
    -- ^ Describes the required quote type of the underlying
    --   price that will be observed. Example values include
    --   'Bid, 'Ask', 'Settlement' (for a
    --   futures contract) and 'WeightedAverage' (for
    --   some published prices and indices).
  deliveryDateReference : Optional DeliveryDateParameters
    -- ^ Specifies the parameters for identifying the relevant
    --   contract date when the commodity reference price is a
    --   futures contract.
  description : Optional Text
    -- ^ Provides additional information about the commodity
    --   underlier.
    deriving (Eq, Ord, Show)

-- | Payout based on the averaged price of a referenced
--   underlier. (e.g. Commodities). Can represent both
--   average (average of many) & bullet (average of 1)
--   pricing
data CommodityPayout = CommodityPayout with 
  payerReceiver : PayerReceiver
    -- ^ Canonical representation of the payer and receiver
    --   parties applicable to each payout leg.
  priceQuantity : Optional ResolvablePriceQuantity
    -- ^ Each payout leg must implement the quantity concept
    --   as a 'resolvable' type, which allows for
    --   different payout legs to be linked to each other
    --   (e.g. in the case of cross-curreny products).
  principalPayment : Optional PrincipalPayments
    -- ^ The specification of the principal exchange. Optional
    --   as only applicable in the case of cross-currency or
    --   zero-coupon swaps with a final payment.
  settlementTerms : Optional SettlementTerms
    -- ^ Each payout leg must specifies its settlement terms,
    --   including the delivery type (i.e. cash vs physical,
    --   and their respective terms), the transfer type (DvP
    --   etc.) and settlement date, if any.
  averagingFeature : Optional AveragingCalculation
    -- ^ Indicates if the averaging calculation, when
    --   applicable, is weighted or unweighted.
  commodityPriceReturnTerms : Optional CommodityPriceReturnTerms
    -- ^ Defines parameters in which the commodity price is
    --   assessed.
  pricingDates : PricingDates
    -- ^ Specifies specific dates or parametric rules for the
    --   dates on which the price will be determined.
  schedule : Optional CalculationSchedule
    -- ^ Allows the full representation of a payout by
    --   defining a set of schedule periods. It supports
    --   standard schedule customization by expressing all the
    --   dates, quantities, and pricing data in a
    --   non-parametric way.
  calculationPeriodDates : Optional CalculationPeriodDates
    -- ^ Defines the calculation period dates schedule.
  paymentDates : PaymentDates
    -- ^ Defines the payment date schedule, as defined by the
    --   parameters that are needed to specify it, either in a
    --   parametric way or by reference to another schedule of
    --   dates (e.g. the valuation dates).
  underlier : (ReferenceWithMeta Commodity)
    -- ^ Identifies the underlying product that is referenced
    --   for pricing of the applicable leg in a swap. 
    --   Referenced in the '2018 ISDA CDM Equity
    --   Confirmation for Security Equity Swap' as
    --   Security.
  fxFeature : Optional FxFeature
    -- ^ Defines quanto or composite FX features that are
    --   included in the swap leg.
  delivery : Optional AssetDeliveryInformation
    -- ^ Contains the information relative to the delivery of
    --   the asset.
    deriving (Eq, Ord, Show)

-- | Defines parameters in which the commodity price is
--   assessed.
data CommodityPriceReturnTerms = CommodityPriceReturnTerms with 
  rounding : Optional Rounding
    -- ^ Defines rounding rules and precision to be used in
    --   the rounding of a number.
  spread : Optional SpreadSchedule
    -- ^ Defines a spread value for one or more defined dates.
  rollFeature : Optional RollFeature
    -- ^ Used in conjunction with an exchange-based pricing
    --   source. Identifies a way in which the futures
    --   contracts referenced will roll between periods. 
  conversionFactor : Optional Decimal
    -- ^ Defines the conversion applied if the quantity unit
    --   on contract is different from unit on referenced
    --   underlier.
    deriving (Eq, Ord, Show)

-- | Specifies the commodity underlier in the event that
--   no ISDA Commodity Reference Price exists.
data CommodityProductDefinition = CommodityProductDefinition with 
  referenceFramework : CommodityReferenceFramework
    -- ^ Specifies the type of commodity.
  priceSource : Optional PriceSource
    -- ^ Specifies a publication that provides the commodity
    --   price, including, where applicable the details of
    --   where in the publication the price is published. 
    --   Applicable when the commodity reference price is not
    --   a futures contract
  commodityInfoPublisher : Optional CommodityInformationPublisherEnum
    -- ^ Specifies the publication where the commodity prices
    --   can be found.
  exchangeId : (FieldWithMeta Text)
    -- ^ Identifies the exchange from which the reference
    --   price should be sourced, using the scheme at the
    --   following url:
    --   http://www.fpml.org/coding-scheme/external/exchange-id-MIC-1-0
    deriving (Eq, Ord, Show)

-- | Specifies the type of commodity.
data CommodityReferenceFramework = CommodityReferenceFramework with 
  commodityName : Text
    -- ^ Identifies the commodity more specifically. Where
    --   possible, this should follow the naming convention
    --   used in the 2005 ISDA Commodity Definitions SubAnnex
    --   A, including the subCommodity and additional
    --   qualifiers, but should be limited to 256 characters
    --   or less.
  capacityUnit : Optional CapacityUnitEnum
    -- ^ Provides an enumerated value for a capacity unit,
    --   generally used in the context of defining quantities
    --   for commodities.
  weatherUnit : Optional WeatherUnitEnum
    -- ^ Provides an enumerated values for a weather unit,
    --   generally used in the context of defining quantities
    --   for commodities.
  currency : (FieldWithMeta Text)
    -- ^ Defines the currency in which the commodity is
    --   priced.
    deriving (Eq, Ord, Show)

-- | Specifies the conditions to be applied for converting
--   into a reference currency when the actual currency
--   rate is not determined upfront.
data Composite = Composite with 
  determinationMethod : Optional DeterminationMethodEnum
    -- ^ Specifies the method according to which an amount or
    --   a date is determined.
  relativeDate : Optional RelativeDateOffset
    -- ^ A date specified as some offset to another date (the
    --   anchor date).
  fxSpotRateSource : Optional FxSpotRateSource
    -- ^ Specifies the methodology (reference source and,
    --   optionally, fixing time) to be used for determining a
    --   currency conversion rate.
  fixingTime : Optional BusinessCenterTime
    -- ^ The time at which the spot currency exchange rate
    --   will be observed. It is specified as a time in a
    --   business day calendar location, e.g. 11:00am London
    --   time.
    deriving (Eq, Ord, Show)

-- | A class to specify the outcome of a computed amount,
--   for testing purposes.
data ComputedAmount = ComputedAmount with 
  callFunction : Text
  amount : Decimal
  currency : Optional (FieldWithMeta Text)
    -- ^ The currency in which the computed amount is
    --   denominated. The list of valid currencies is not
    --   presently positioned as an enumeration as part of the
    --   CDM because that scope is limited to the values
    --   specified by ISDA and FpML. As a result, implementers
    --   have to make reference to the relevant standard, such
    --   as the ISO 4217 standard for currency codes.
    deriving (Eq, Ord, Show)

-- | Represents a class to describe concentration limits
--   that may be applicable to eligible collateral
--   criteria.
data ConcentrationLimit = ConcentrationLimit with 
  concentrationLimitCriteria : [ConcentrationLimitCriteria]
    -- ^ Specifies a set of criteria to describe the assets
    --   that the concentration limits apply to.
  valueLimit : Optional MoneyRange
    -- ^ Specifies the value of collateral limit represented
    --   as a range.
  percentageLimit : Optional NumberRange
    -- ^ Specifies the perecentage of collateral limit
    --   represented as a decimal number - example 25% is
    --   0.25.
    deriving (Eq, Ord, Show)

-- | Respresents a class to describe a set of criteria to
--   describe specific assets that the concentration
--   limits apply to.
data ConcentrationLimitCriteria = ConcentrationLimitCriteria with 
  issuer : [IssuerCriteria]
    -- ^ Represents a filter based criteria related to the
    --   issuer.
  asset : [AssetCriteria]
    -- ^ Represents a filter based on the criteria related to
    --   the asset.
  appliesTo : [CounterpartyRoleEnum]
    -- ^ Specifies which of the two counterparties the
    --   criteria applies to (either one or both
    --   counterparties). This attribute is optional, in case
    --   the applicable party is already specified elsewhere
    --   within a party election.
  restrictTo : Optional CollateralMarginTypeEnum
    -- ^ Restrict the criteria to only apply to a specific
    --   type of margin, ie IM or VM.
  ratingPriorityResolution : Optional RatingPriorityResolutionEnum
    -- ^ Denotes which Criteria has priority if more than one
    --   agency rating applies.
  concentrationLimitType : Optional ConcentrationLimitTypeEnum
    -- ^ Specifies the type of concentration limit to be
    --   applied.
  averageTradingVolume : Optional AverageTradingVolume
    -- ^ Specifies an average trading volume on an exchange in
    --   relation to Equity products.
    deriving (Eq, Ord, Show)

-- | A class describing the weight of each of the
--   underlier constituent within the basket, either in
--   absolute or relative terms.
data ConstituentWeight = ConstituentWeight with 
  openUnits : Optional Decimal
    -- ^ The number of units (index or securities) that
    --   constitute the underlier of the swap. In the case of
    --   a basket swap, this element is used to reference both
    --   the number of basket units, and the number of each
    --   asset components of the basket when these are
    --   expressed in absolute terms.
  basketPercentage : Optional Decimal
    -- ^ The relative weight of each respective basket
    --   constituent, expressed in percentage. A basket
    --   percentage of 5% would be represented as 0.05.
    deriving (Eq, Ord, Show)

-- | A class to specify the parties' election to
--   specify contact information, in relation to elections
--   such as the Addresses for Transfer or the Demand and
--   Notices as specified in the ISDA Credit Support Annex
--   agreement.
data ContactElection = ContactElection with 
  partyElection : [PartyContactInformation]
    -- ^ The parties' contact information election.
    deriving (Eq, Ord, Show)

-- | A class to specify contact information associated
--   with a party: telephone, postal/street address, email
--   and web page.
data ContactInformation = ContactInformation with 
  telephone : [TelephoneNumber]
    -- ^ The telephone number.
  address : [Address]
    -- ^ The street/postal address.
  email : [Text]
    -- ^ The email address.
  webPage : [Text]
    -- ^ The web page. This attribute is not specified as part
    --   of the FpML ContactInformation complex type.
    deriving (Eq, Ord, Show)

-- | Encapsulates data features common to trade and
--   position.
data ContractBase = ContractBase with 
  contractDetails : Optional (ReferenceWithMeta ContractDetails)
    -- ^ Represents information specific to trades or
    --   positions involving contractual products.
  executionDetails : Optional (ReferenceWithMeta ExecutionDetails)
    -- ^ Defines specific attributes that relate to trade or
    --   position executions.
  collateral : Optional (ReferenceWithMeta Collateral)
    -- ^ Represents the collateral obligations of a party.
    deriving (Eq, Ord, Show)

-- | Defines specific attributes that relate to
--   contractual details of trades.
data ContractDetails = ContractDetails with 
  documentation : [LegalAgreement]
    -- ^ Represents the legal document(s) that governs a trade
    --   and associated contractual product terms, either as a
    --   reference to such documents when specified as part of
    --   the CDM, or through identification of some of the key
    --   terms of those documents, such as the type of
    --   document, the document identifier, the publisher, the
    --   document vintage and the agreement date.
  governingLaw : Optional (FieldWithMeta GoverningLawEnum)
    -- ^ Represents the law governing the trade and associated
    --   contractual product terms.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | Specifies instructions to create a fully formed
--   contract, with optional legal agreements.
data ContractFormationInstruction = ContractFormationInstruction with 
  legalAgreement : [LegalAgreement]
    -- ^ Optional legal agreements associated to the contract
    --   being formed, for instance a master agreement.
    deriving (Eq, Ord, Show)

data ContractualMatrix = ContractualMatrix with 
  matrixType : (FieldWithMeta MatrixTypeEnum)
    -- ^ Identifies the form of applicable matrix.
  matrixTerm : Optional (FieldWithMeta MatrixTermEnum)
    -- ^ Defines any applicable key into the relevant matrix.
    --   For example, the Transaction Type would be the single
    --   term required for the Credit Derivatives Physical
    --   Settlement Matrix. This element should be omitted in
    --   the case of the 2000 ISDA Definitions Settlement
    --   Matrix for Early Termination and Swaptions.
    deriving (Eq, Ord, Show)

-- | A contractual supplement (such as those published by
--   ISDA) and its publication date that will apply to the
--   trade.
data ContractualTermsSupplement = ContractualTermsSupplement with 
  contractualTermsSupplementType : (FieldWithMeta ContractualSupplementTypeEnum)
    -- ^ Identifies the form of applicable contractual
    --   supplement.
  publicationDate : Optional Date
    -- ^ Specifies the publication date of the applicable
    --   version of the contractual supplement.
    deriving (Eq, Ord, Show)

-- | Specifies the relevant data regarding a corporate
--   action.
data CorporateAction = CorporateAction with 
  corporateActionType : CorporateActionTypeEnum
    -- ^ The type of corporate action taking place.
  exDate : Date
    -- ^ The date on which the corporate action is known to
    --   have taken place.
  payDate : Date
    -- ^ The date on which resulting from the corporate action
    --   are delivered.
  underlier : Underlier
    -- ^ The underlier impacted by the corporate action.
    deriving (Eq, Ord, Show)

data CorrelationReturnTerms = CorrelationReturnTerms with 
  valuationTerms : ValuationTerms
    -- ^ Contains all non-date valuation information.
  annualizationFactor : Optional Int
    -- ^ This specifies the numerator of an annualization
    --   factor. Frequently this number is equal to the number
    --   of observations of prices in a year e.g. 252.
  dividendApplicability : Optional DividendApplicability
    -- ^ The parameters which define whether dividends are
    --   applicable
  equityUnderlierProvisions : Optional EquityUnderlierProvisions
    -- ^ Contains Equity Underlyer provisions regarding
    --   jurisdiction and fallbacks.
  sharePriceDividendAdjustment : Optional Bool
    -- ^ Indicates whether the price of shares is adjusted for
    --   dividends or not.
  expectedN : Int
    -- ^ Expected number of trading days.
  initialLevel : Optional Decimal
    -- ^ Contract will strike off this initial level.
    --   Providing just the initialLevel without
    --   initialLevelSource, infers that this is
    --   AgreedInitialPrice - a specified Initial Index Level.
  initialLevelSource : Optional DeterminationMethodEnum
    -- ^ In this context, this is AgreedInitialPrice - a
    --   specified Initial Index Level.
  meanAdjustment : Optional Bool
    -- ^ Specifies whether Mean Adjustment is applicable or
    --   not in the calculation of the Realized Volatility,
    --   Variance or Correlation
  performance : Optional Text
    -- ^ Performance calculation, in accordance with Part 1
    --   Section 12 of the 2018 ISDA CDM Equity Confirmation
    --   for Security Equity Swap, Para 75. 'Equity
    --   Performance'. Cumulative performance is used as a
    --   notional multiplier factor on both legs of an Equity
    --   Swap.
  correlationStrikePrice : Price
    -- ^ Correlation Strike Price in accordance with the ISDA
    --   2011 Equity Derivatives Definitions.
  boundedCorrelation : Optional NumberRange
    -- ^ Describes correlation bounds, which form a cap and a
    --   floor on the realized correlation.
  numberOfDataSeries : Optional Int
    -- ^ Number of data series, normal market practice is that
    --   correlation data sets are drawn from geographic
    --   market areas, such as America, Europe and Asia
    --   Pacific, each of these geographic areas will have its
    --   own data series to avoid contagion.
    deriving (Eq, Ord, Show)

-- | Defines a counterparty enumerated value, e.g. Party1
--   or Party2, with an associated party reference. The
--   product is agnostic to the actual parties to the
--   transaction, with the party references abstracted
--   away from the product definition and replaced by the
--   CounterpartyEnum (e.g. values Party1 or Party2). The
--   CounterpartyEnum can then be positioned in the
--   product (e.g. to specify which counterparty is the
--   payer, receiver etc) and this Counterparty type,
--   which is positioned outside of the product
--   definition, allows the CounterpartyEnum to be
--   associated with an actual party reference.
data Counterparty = Counterparty with 
  role : CounterpartyRoleEnum
    -- ^ Specifies the CounterpartyEnum, e.g. either Party1 or
    --   Party2, that is associated to the partyReference.
  partyReference : (ReferenceWithMeta Party)
    -- ^ Specifies the party that is associated to the
    --   counterparty.
    deriving (Eq, Ord, Show)

-- | A Position describes the accumulated effect of a set
--   of securities or financial transactions.
data CounterpartyPosition = CounterpartyPosition with 
  contractDetails : Optional (ReferenceWithMeta ContractDetails)
    -- ^ Represents information specific to trades or
    --   positions involving contractual products.
  executionDetails : Optional (ReferenceWithMeta ExecutionDetails)
    -- ^ Defines specific attributes that relate to trade or
    --   position executions.
  collateral : Optional (ReferenceWithMeta Collateral)
    -- ^ Represents the collateral obligations of a party.
  positionIdentifier : [PositionIdentifier]
    -- ^ Represents the identifier(s) that uniquely identify a
    --   position for an identity issuer. A position can
    --   include multiple identifiers, for example an internal
    --   position identifer and a UTI (Unique Trade
    --   Identifier).
  openDateTime : Optional Time
    -- ^ The date and time when the position was opened.
  tradeReference : [ReferenceWithMeta TradeState]
    -- ^ Reference to all the trades that constitute the
    --   position.
  party : [Party]
    -- ^ The parties involved in the position, including the
    --   Clearing Organization.
  partyRole : [PartyRole]
    -- ^ Represents the role each specified party takes in the
    --   position.
  positionBase : TradableProduct
    -- ^ Encapsulates the core constituents that characterize
    --   a position.
    deriving (Eq, Ord, Show)

-- | A business event represents a life cycle event of a
--   position. The combination of the state changes
--   results in a qualifiable life cycle event.
data CounterpartyPositionBusinessEvent = CounterpartyPositionBusinessEvent with 
  intent : PositionEventIntentEnum
    -- ^ The intent attribute is meant to be specified when
    --   the event qualification cannot be programmatically
    --   inferred from the event features. As a result it is
    --   only associated with those primitives that can give
    --   way to such ambiguity, the quantityChange being one
    --   of those.
  corporateActionIntent : Optional CorporateActionTypeEnum
    -- ^ The intent of a corporate action on the position.
  eventDate : Optional Date
    -- ^ Specifies the date on which the event is taking
    --   place. This date is equal to the trade date in the
    --   case of a simple execution.  However it can be
    --   different from the trade date, for example in the
    --   case of a partial termination.
  effectiveDate : Optional Date
    -- ^ The date on which the event contractually takes
    --   effect, when different from the event date.
  packageInformation : Optional IdentifiedList
    -- ^ Specifies the package information in case the
    --   business event represents several trades executed as
    --   a package (hence this attribute is optional). The
    --   package information is only instantiated once at the
    --   business event level to preserve referential
    --   integrity, whereas individual trades make reference
    --   to it to identify that they are part of a package.
  after : [CounterpartyPositionState]
    -- ^ Specifies the after position state(s) created.
    deriving (Eq, Ord, Show)

-- | Defines the fundamental financial information that
--   can be changed by a Primitive Event and by extension
--   any business or life-cycle event. Each PositionState
--   specifies where a Position is in its life-cycle.
--   PositionState is a root type and as such, can be
--   created independently to any other CDM data type, but
--   can also be used as part of the CDM Event Model.
data CounterpartyPositionState = CounterpartyPositionState with 
  counterpartyPosition : CounterpartyPosition
    -- ^ Represents the Position that has been effected by a
    --   business or life-cycle event.
  state : Optional State
    -- ^ Represents the State of the Position through its
    --   life-cycle.
  observationHistory : [ObservationEvent]
    -- ^ Represents the observed events related to a
    --   particular product or process, such as credit events
    --   or corporate actions.
  valuationHistory : [Valuation]
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | The credit default payout specification provides the
--   details necessary for determining when a credit
--   payout will be triggered as well as the parameters
--   for calculating the payout and the settlement terms.
--   The associated globalKey denotes the ability to
--   associate a hash value to the CreditDefaultPayout
--   instantiations for the purpose of model
--   cross-referencing, in support of functionality such
--   as the event effect and the lineage.
data CreditDefaultPayout = CreditDefaultPayout with 
  payerReceiver : PayerReceiver
    -- ^ Canonical representation of the payer and receiver
    --   parties applicable to each payout leg.
  priceQuantity : Optional ResolvablePriceQuantity
    -- ^ Each payout leg must implement the quantity concept
    --   as a 'resolvable' type, which allows for
    --   different payout legs to be linked to each other
    --   (e.g. in the case of cross-curreny products).
  principalPayment : Optional PrincipalPayments
    -- ^ The specification of the principal exchange. Optional
    --   as only applicable in the case of cross-currency or
    --   zero-coupon swaps with a final payment.
  settlementTerms : Optional SettlementTerms
    -- ^ Each payout leg must specifies its settlement terms,
    --   including the delivery type (i.e. cash vs physical,
    --   and their respective terms), the transfer type (DvP
    --   etc.) and settlement date, if any.
  generalTerms : GeneralTerms
    -- ^ The specification of the non-monetary terms for the
    --   Credit Derivative Transaction, including the buyer
    --   and seller and selected items from the ISDA 2014
    --   Credit Definition article II, such as the reference
    --   obligation and related terms.
  protectionTerms : [ProtectionTerms]
    -- ^ Specifies the terms for calculating a payout to
    --   protect the buyer of the swap in the case of a
    --   qualified credit event. These terms include the
    --   applicable credit events, the reference obligation,
    --   and in the case of a CDS on mortgage-backed
    --   securities, the floatingAmountEvents.
  transactedPrice : Optional TransactedPrice
    -- ^ The qualification of the price at which the contract
    --   has been transacted, in terms of market fixed rate,
    --   initial points, market price and/or quotation style.
    --   In FpML, those attributes are positioned as part of
    --   the fee leg.
    deriving (Eq, Ord, Show)

-- | Specifies the relevant data regarding a credit event.
data CreditEvent = CreditEvent with 
  creditEventType : CreditEventTypeEnum
    -- ^ The type of credit event taking place.
  eventDeterminationDate : Date
    -- ^ The date in which the credit event is determined by
    --   the Credit Derivatives Determinations Comitee.
  auctionDate : Optional Date
    -- ^ The date on which the auction is scheduled to occur.
  finalPrice : Optional Price
    -- ^ The final price resulting from the auction.
  recoveryPercent : Optional Decimal
    -- ^ The percentage of the original value of the asset
    --   affected by the credit event that can be recovered.
  publiclyAvailableInformation : [Resource]
    -- ^ A public information source, e.g. a particular
    --   newspaper or electronic news service, that may
    --   publish relevant information used in the
    --   determination of whether or not a credit event has
    --   occurred.
  referenceInformation : ReferenceInformation
    -- ^ The reference entity, part of a credit basket,
    --   impacted by the credit event.
    deriving (Eq, Ord, Show)

data CreditEventNotice = CreditEventNotice with 
  notifyingParty : [CounterpartyRoleEnum]
    -- ^ The notifying party is the party that notifies the
    --   other party when a credit event has occurred by means
    --   of a credit event notice. If more than one party is
    --   referenced as being the notifying party then either
    --   party may notify the other of a credit event
    --   occurring. ISDA 2003 Term: Notifying Party.
  businessCenter : Optional BusinessCenterEnum
    -- ^ Inclusion of this business center element implies
    --   that Greenwich Mean Time in Section 3.3 of the 2003
    --   ISDA Credit Derivatives Definitions is replaced by
    --   the local time of the city indicated by the
    --   businessCenter element value.
  publiclyAvailableInformation : Optional PubliclyAvailableInformation
    -- ^ A specified condition to settlement. Publicly
    --   available information means information that
    --   reasonably confirms any of the facts relevant to
    --   determining that a credit event or potential
    --   repudiation/moratorium, as applicable, has occurred.
    --   The ISDA defined list (2003) is the market standard
    --   and is considered comprehensive, and a minimum of two
    --   differing public sources must have published the
    --   relevant information, to declare a Credit Event. ISDA
    --   2003 Term: Notice of Publicly Available Information
    --   Applicable.
    deriving (Eq, Ord, Show)

-- | A class to specify the applicable Credit Events that
--   would trigger a settlement, as specified in the
--   related Confirmation and defined in the ISDA 2014
--   Credit Definition article IV section 4.1.
data CreditEvents = CreditEvents with 
  bankruptcy : Optional Bool
    -- ^ A credit event. The reference entity has been
    --   dissolved or has become insolvent. It also covers
    --   events that may be a precursor to insolvency such as
    --   instigation of bankruptcy or insolvency proceedings.
    --   Sovereign trades are not subject to Bankruptcy as
    --   'technically' a Sovereign cannot become
    --   bankrupt. ISDA 2003 Term: Bankruptcy.
  failureToPay : Optional FailureToPay
    -- ^ A credit event. This credit event triggers, after the
    --   expiration of any applicable grace period, if the
    --   reference entity fails to make due payments in an
    --   aggregate amount of not less than the payment
    --   requirement on one or more obligations (e.g. a missed
    --   coupon payment). ISDA 2003 Term: Failure to Pay.
  failureToPayPrincipal : Optional Bool
    -- ^ A credit event. Corresponds to the failure by the
    --   Reference Entity to pay an expected principal amount
    --   or the payment of an actual principal amount that is
    --   less than the expected principal amount. ISDA 2003
    --   Term: Failure to Pay Principal.
  failureToPayInterest : Optional Bool
    -- ^ A credit event. Corresponds to the failure by the
    --   Reference Entity to pay an expected interest amount
    --   or the payment of an actual interest amount that is
    --   less than the expected interest amount. ISDA 2003
    --   Term: Failure to Pay Interest.
  obligationDefault : Optional Bool
    -- ^ A credit event. One or more of the obligations have
    --   become capable of being declared due and payable
    --   before they would otherwise have been due and payable
    --   as a result of, or on the basis of, the occurrence of
    --   a default, event of default or other similar
    --   condition or event other than failure to pay. ISDA
    --   2003 Term: Obligation Default.
  obligationAcceleration : Optional Bool
    -- ^ A credit event. One or more of the obligations have
    --   been declared due and payable before they would
    --   otherwise have been due and payable as a result of,
    --   or on the basis of, the occurrence of a default,
    --   event of default or other similar condition or event
    --   other than failure to pay (preferred by the market
    --   over Obligation Default, because more definitive and
    --   encompasses the definition of Obligation Default -
    --   this is more favorable to the Seller). Subject to the
    --   default requirement amount. ISDA 2003 Term:
    --   Obligation Acceleration.
  repudiationMoratorium : Optional Bool
    -- ^ A credit event. The reference entity, or a
    --   governmental authority, either refuses to recognise
    --   or challenges the validity of one or more obligations
    --   of the reference entity, or imposes a moratorium
    --   thereby postponing payments on one or more of the
    --   obligations of the reference entity. Subject to the
    --   default requirement amount. ISDA 2003 Term:
    --   Repudiation/Moratorium.
  restructuring : Optional Restructuring
    -- ^ A credit event. A restructuring is an event that
    --   materially impacts the reference entity's
    --   obligations, such as an interest rate reduction,
    --   principal reduction, deferral of interest or
    --   principal, change in priority ranking, or change in
    --   currency or composition of payment. ISDA 2003 Term:
    --   Restructuring.
  governmentalIntervention : Optional Bool
    -- ^ A credit event. A governmental intervention is an
    --   event resulting from an action by a governmental
    --   authority that materially impacts the reference
    --   entity's obligations, such as an interest rate
    --   reduction, principal reduction, deferral of interest
    --   or principal, change in priority ranking, or change
    --   in currency or composition of payment. ISDA 2014
    --   Term: Governmental Intervention.
  distressedRatingsDowngrade : Optional Bool
    -- ^ A credit event. Results from the fact that the rating
    --   of the reference obligation is down-graded to a
    --   distressed rating level. From a usage standpoint,
    --   this credit event is typically not applicable in case
    --   of RMBS trades.
  maturityExtension : Optional Bool
    -- ^ A credit event. Results from the fact that the
    --   underlier fails to make principal payments as
    --   expected.
  writedown : Optional Bool
    -- ^ A credit event. Results from the fact that the
    --   underlier writes down its outstanding principal
    --   amount.
  impliedWritedown : Optional Bool
    -- ^ A credit event. Results from the fact that losses
    --   occur to the underlying instruments that do not
    --   result in reductions of the outstanding principal of
    --   the reference obligation.
  defaultRequirement : Optional Money
    -- ^ In relation to certain credit events, serves as a
    --   threshold for Obligation Acceleration, Obligation
    --   Default, Repudiation/Moratorium and Restructuring.
    --   Market standard is USD 10,000,000 (JPY 1,000,000,000
    --   for all Japanese Yen trades). This is applied on an
    --   aggregate or total basis across all Obligations of
    --   the Reference Entity. Used to prevent
    --   technical/operational errors from triggering credit
    --   events. ISDA 2003 Term: Default Requirement.
  creditEventNotice : Optional CreditEventNotice
    -- ^ A specified condition to settlement. An irrevocable
    --   written or verbal notice that describes a credit
    --   event that has occurred. The notice is sent from the
    --   notifying party (either the buyer or the seller) to
    --   the counterparty. It provides information relevant to
    --   determining that a credit event has occurred. This is
    --   typically accompanied by Publicly Available
    --   Information. ISDA 2003 Term: Credit Event Notice.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | Specification of an index based on credit risk,
--   typically composed using corporate debt instruments
--   in a region or industry sector, e.g. the iTraxx
--   indices.
data CreditIndex = CreditIndex with 
  identifier : [AssetIdentifier]
    -- ^ Asset Identifiers are used to uniquely identify an
    --   Asset, using a specified Asset Identifier Type.
  taxonomy : [Taxonomy]
    -- ^ Defines the taxonomy of an object by combining a
    --   taxonomy source (i.e. the rules to classify the
    --   object) and a value (i.e. the output of those rules
    --   on the object.
  isExchangeListed : Optional Bool
    -- ^ Defines whether the Asset is listed on a public
    --   exchange.
  exchange : Optional LegalEntity
    -- ^ If the Asset is listed, defines the public exchange
    --   of the listing.
  relatedExchange : [LegalEntity]
    -- ^ Provides the related Exchanges, if applicable.
  name : Optional (FieldWithMeta Text)
    -- ^ A description of the Index.
  provider : Optional LegalEntity
    -- ^ The organisation that creates or maintains the Index.
  assetClass : Optional AssetClassEnum
    -- ^ The Asset Class of the Index.
  indexSeries : Optional Int
    -- ^ A CDS index series identifier, e.g. 1, 2, 3 etc.
  indexAnnexVersion : Optional Int
    -- ^ A CDS index series version identifier, e.g. 1, 2, 3
    --   etc.
  indexAnnexDate : Optional Date
    -- ^ A CDS index series annex date.
  indexAnnexSource : Optional (FieldWithMeta IndexAnnexSourceEnum)
    -- ^ A CDS index series annex source.
  excludedReferenceEntity : [ReferenceInformation]
    -- ^ Excluded reference entity.
  tranche : Optional Tranche
    -- ^ This element contains CDS tranche terms.
  settledEntityMatrix : Optional SettledEntityMatrix
    -- ^ Used to specify the Relevant Settled Entity Matrix
    --   when there are settled entities at the time of the
    --   trade.
  indexFactor : Optional Decimal
    -- ^ Index Factor is the index version factor or percent,
    --   expressed as an absolute decimal value between 0 and
    --   1, that multiplied by the original notional amount
    --   yields the notional amount covered by the seller of
    --   protection.
  seniority : Optional CreditSeniorityEnum
    -- ^ Seniority of debt instruments comprising the index.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A class to represent the credit limit utilisation
--   information.
data CreditLimitInformation = CreditLimitInformation with 
  limitApplicable : [LimitApplicableExtended]
    deriving (Eq, Ord, Show)

-- | Credit limit utilisation breakdown by executed trades
--   and pending orders.
data CreditLimitUtilisation = CreditLimitUtilisation with 
  executed : Optional CreditLimitUtilisationPosition
    -- ^ Credit limit utilisation attributable to executed
    --   trades.
  pending : Optional CreditLimitUtilisationPosition
    -- ^ Credit limit utilisation attributable to pending
    --   unexecuted orders.
    deriving (Eq, Ord, Show)

data CreditLimitUtilisationPosition = CreditLimitUtilisationPosition with 
  shortPosition : Optional Decimal
    -- ^ Credit limit utilisation attributable to short
    --   positions.
  longPosition : Optional Decimal
    -- ^ Credit limit utilisation attributable to long
    --   positions.
  global : Optional Decimal
    -- ^ Global credit limit utilisation amount, agnostic of
    --   long/short position direction.
    deriving (Eq, Ord, Show)

-- | Represents a class to specify the credit notation as
--   the combination of agency, notation, scale and debt
--   type qualifications.
data CreditNotation = CreditNotation with 
  agency : CreditRatingAgencyEnum
    -- ^ Specifies The credit agency to which the other
    --   variables (notation, scale, debt type) refer to.
  notation : (FieldWithMeta Text)
    -- ^ Specifies The credit rating notation. As it varies
    --   among credit rating agencies, FpML doesn't
    --   specify a default scheme.
  scale : Optional (FieldWithMeta Text)
    -- ^ Specifies the credit rating scale, with a typical
    --   distinction between short term, long term. FpML
    --   doesn't specify a default scheme, which is hence
    --   not specified as an enumeration as part of the CDM.
  debt : Optional CreditRatingDebt
    -- ^ Specifies the credit rating debt type (e.g. long
    --   term, high yield, deposits, ...) associated with the
    --   credit rating notation and scale.
  outlook : Optional CreditRatingOutlookEnum
    -- ^ Assesses the potential direction of a long-term
    --   credit rating over the intermediate term, which is
    --   generally up to two years for investment grade and
    --   generally up to one year for speculative grade.
  creditWatch : Optional CreditRatingCreditWatchEnum
    -- ^ Indicates the potential direction of a short-term or
    --   long-term rating. It focuses on identifiable events
    --   and short-term trends that cause ratings to be placed
    --   under special surveillance.
    deriving (Eq, Ord, Show)

-- | Represents the credit rating notation higher level
--   construct, which provides the ability to specify
--   multiple rating notations.
data CreditNotations = CreditNotations with 
  creditNotation : Optional CreditNotation
    -- ^ Specifies only one credit notation is determined.
  creditNotations : Optional MultipleCreditNotations
    -- ^ Specifies if several credit notations exist,
    --   alongside an 'any' or 'all' or all
    --   condition.
    deriving (Eq, Ord, Show)

-- | Specifies the credit rating debt type(s) associated
--   with the credit rating notation and scale. When
--   several debt types are specified, they must be
--   qualified through an 'any' or 'all'.
data CreditRatingDebt = CreditRatingDebt with 
  debtType : Optional (FieldWithMeta Text)
    -- ^ Specifies when there is only one debt type. FpML
    --   doesn't specify values in relation to the
    --   associated scheme, which is hence not specified as an
    --   enumeration as part of the CDM.
  debtTypes : Optional MultipleDebtTypes
    -- ^ Specifies if there are several debt types, alongside
    --   an 'any' or 'all' or all condition.
    --   As an example, Baa1 rating is required for any long
    --   term debt and deposit.
    deriving (Eq, Ord, Show)

-- | The set of elections which specify a Credit Support
--   Annex or Deed.
data CreditSupportAgreementElections = CreditSupportAgreementElections with 
    deriving (Eq, Ord, Show)

data Curve = Curve with 
  interestRateCurve : Optional InterestRateCurve
  commodityCurve : Optional (FieldWithMeta CommodityReferencePriceEnum)
    deriving (Eq, Ord, Show)

-- | A class to specify an offset either as a normalized
--   [multiplier, period, dayType] or as a custom
--   provision of type string.
data CustomisableOffset = CustomisableOffset with 
  offset : Optional Offset
  customProvision : Optional Text
    deriving (Eq, Ord, Show)

-- | In its initial iteration, this class is meant to
--   support the DTCC TIW workflow information.
data CustomisedWorkflow = CustomisedWorkflow with 
  itemName : Text
    -- ^ In this initial iteration, this corresponds to the
    --   DTCC TIW element name.
  itemValue : Text
    -- ^ In this initial iteration, this corresponds to the
    --   DTCC value.
    deriving (Eq, Ord, Show)

-- | List of dates.
data DateList = DateList with 
  date : [Date]
    deriving (Eq, Ord, Show)

-- | A class defining a contiguous series of calendar
--   dates. The date range is defined as all the dates
--   between and including the start and the end date. The
--   start date must fall on or before the end date.
data DateRange = DateRange with 
  startDate : Date
    -- ^ The first date of a date range.
  endDate : Date
    -- ^ The last date of a date range.
    deriving (Eq, Ord, Show)

-- | A data to:  provide the ability to point to multiple
--   payment nodes in the document through the unbounded
--   paymentDatesReference.
data DateRelativeToCalculationPeriodDates = DateRelativeToCalculationPeriodDates with 
  calculationPeriodDatesReference : [ReferenceWithMeta CalculationPeriodDates]
    -- ^ A set of href pointers to calculation period dates
    --   defined somewhere else in the document.
    deriving (Eq, Ord, Show)

-- | A data to:  provide the ability to point to multiple
--   payment nodes in the document through the unbounded
--   paymentDatesReference.
data DateRelativeToPaymentDates = DateRelativeToPaymentDates with 
  paymentDatesReference : [ReferenceWithMeta PaymentDates]
    -- ^ A set of href pointers to payment dates defined
    --   somewhere else in the document.
    deriving (Eq, Ord, Show)

-- | A data to:  provide the ability to point to multiple
--   payment nodes in the document through the unbounded
--   paymentDatesReference.
data DateRelativeToValuationDates = DateRelativeToValuationDates with 
  valuationDatesReference : [ReferenceWithMeta PerformanceValuationDates]
    -- ^ A set of href pointers to valuation period dates
    --   defined somewhere else in the document.
    deriving (Eq, Ord, Show)

-- | List of dateTimes.
data DateTimeList = DateTimeList with 
  dateTime : [ZonedDateTime]
    -- ^ The CDM specifies that the zoned date time is to be
    --   expressed in accordance with ISO 8601, either as UTC
    --   as an offset to UTC.
    deriving (Eq, Ord, Show)

-- | Defines a date and value pair. This definition is
--   used for varying rate or amount schedules, e.g. a
--   notional amortisation or a step-up coupon schedule.
data DatedValue = DatedValue with 
  date : Date
    -- ^ The date on which the associated step value becomes
    --   effective. This day may be subject to adjustment in
    --   accordance with a business day convention.
  value : Decimal
    -- ^ The rate of amount which becomes effective on the
    --   associated step date. A rate of 5% would be
    --   represented as 0.05.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | Specifies selected economics of a debt instrument.
data DebtEconomics = DebtEconomics with 
  debtSeniority : Optional DebtSeniorityEnum
    -- ^ Specifies the order of repayment in the event of a
    --   sale or bankruptcy of the issuer or a related party
    --   (eg guarantor).
  debtInterest : Optional DebtInterestEnum
    -- ^ Specifies the general rule for periodic interest rate
    --   payment.
  debtPrincipal : Optional DebtPrincipalEnum
    -- ^ Specifies the general rule for repayment of
    --   principal.
    deriving (Eq, Ord, Show)

-- | Specifies the type of debt instrument.
data DebtType = DebtType with 
  debtClass : Optional DebtClassEnum
    -- ^ Specifies the characteristics of a debt instrument.
  debtEconomics : [DebtEconomics]
    -- ^ Specifies selected financial terms of a debt
    --   instrument.
    deriving (Eq, Ord, Show)

-- | A class to specify all the ISDA terms relevant to
--   defining the deliverable obligations.
data DeliverableObligations = DeliverableObligations with 
  accruedInterest : Optional Bool
    -- ^ Indicates whether accrued interest is included (true)
    --   or not (false). For cash settlement this specifies
    --   whether quotations should be obtained inclusive or
    --   not of accrued interest. For physical settlement this
    --   specifies whether the buyer should deliver the
    --   obligation with an outstanding principal balance that
    --   includes or excludes accrued interest. ISDA 2003
    --   Term: Include/Exclude Accrued Interest.
  category : Optional ObligationCategoryEnum
    -- ^ Used in both obligations and deliverable obligations
    --   to represent a class or type of securities which
    --   apply. ISDA 2003 Term: Obligation
    --   Category/Deliverable Obligation Category.
  notSubordinated : Optional Bool
    -- ^ An obligation and deliverable obligation
    --   characteristic. An obligation that ranks at least
    --   equal with the most senior Reference Obligation in
    --   priority of payment or, if no Reference Obligation is
    --   specified in the related Confirmation, the
    --   obligations of the Reference Entity that are senior.
    --   ISDA 2003 Term: Not Subordinated.
  specifiedCurrency : Optional SpecifiedCurrency
    -- ^ An obligation and deliverable obligation
    --   characteristic. The currency or currencies in which
    --   an obligation or deliverable obligation must be
    --   payable. ISDA 2003 Term: Specified Currency.
  notSovereignLender : Optional Bool
    -- ^ An obligation and deliverable obligation
    --   characteristic. Any obligation that is not primarily
    --   (majority) owed to a Sovereign or Supranational
    --   Organisation. ISDA 2003 Term: Not Sovereign Lender.
  notDomesticCurrency : Optional NotDomesticCurrency
    -- ^ An obligation and deliverable obligation
    --   characteristic. Any obligation that is payable in any
    --   currency other than the domestic currency. Domestic
    --   currency is either the currency so specified or, if
    --   no currency is specified, the currency of (a) the
    --   reference entity, if the reference entity is a
    --   sovereign, or (b) the jurisdiction in which the
    --   relevant reference entity is organised, if the
    --   reference entity is not a sovereign. ISDA 2003 Term:
    --   Not Domestic Currency.
  notDomesticLaw : Optional Bool
    -- ^ An obligation and deliverable obligation
    --   characteristic. If the reference entity is a
    --   Sovereign, this means any obligation that is not
    --   subject to the laws of the reference entity. If the
    --   reference entity is not a sovereign, this means any
    --   obligation that is not subject to the laws of the
    --   jurisdiction of the reference entity. ISDA 2003 Term:
    --   Not Domestic Law.
  listed : Optional Bool
    -- ^ An obligation and deliverable obligation
    --   characteristic. Indicates whether or not the
    --   obligation is quoted, listed or ordinarily purchased
    --   and sold on an exchange. ISDA 2003 Term: Listed.
  notContingent : Optional Bool
    -- ^ A deliverable obligation characteristic. In essence
    --   Not Contingent means the repayment of principal
    --   cannot be dependant on a formula/index, i.e. to
    --   prevent the risk of being delivered an instrument
    --   that may never pay any element of principal, and to
    --   ensure that the obligation is interest bearing (on a
    --   regular schedule). ISDA 2003 Term: Not Contingent.
  notDomesticIssuance : Optional Bool
    -- ^ An obligation and deliverable obligation
    --   characteristic. Any obligation other than an
    --   obligation that was intended to be offered for sale
    --   primarily in the domestic market of the relevant
    --   Reference Entity. This specifies that the obligation
    --   must be an internationally recognised bond. ISDA 2003
    --   Term: Not Domestic Issuance.
  assignableLoan : Optional PCDeliverableObligationCharac
    -- ^ A deliverable obligation characteristic. A loan that
    --   is freely assignable to a bank or financial
    --   institution without the consent of the Reference
    --   Entity or the guarantor, if any, of the loan (or the
    --   consent of the applicable borrower if a Reference
    --   Entity is guaranteeing the loan) or any agent. ISDA
    --   2003 Term: Assignable Loan.
  consentRequiredLoan : Optional PCDeliverableObligationCharac
    -- ^ A deliverable obligation characteristic. A loan that
    --   is capable of being assigned with the consent of the
    --   Reference Entity or the guarantor, if any, of the
    --   loan or any agent. ISDA 2003 Term: Consent Required
    --   Loan.
  directLoanParticipation : Optional LoanParticipation
    -- ^ A deliverable obligation characteristic. A loan with
    --   a participation agreement whereby the buyer is
    --   capable of creating, or procuring the creation of, a
    --   contractual right in favour of the seller that
    --   provides the seller with recourse to the
    --   participation seller for a specified share in any
    --   payments due under the relevant loan which are
    --   received by the participation seller. ISDA 2003 Term:
    --   Direct Loan Participation.
  transferable : Optional Bool
    -- ^ A deliverable obligation characteristic. An
    --   obligation that is transferable to institutional
    --   investors without any contractual, statutory or
    --   regulatory restrictions. ISDA 2003 Term:
    --   Transferable.
  maximumMaturity : Optional Period
    -- ^ A deliverable obligation characteristic. An
    --   obligation that has a remaining maturity from the
    --   Physical Settlement Date of not greater than the
    --   period specified. ISDA 2003 Term: Maximum Maturity.
  acceleratedOrMatured : Optional Bool
    -- ^ A deliverable obligation characteristic. An
    --   obligation at time of default is due to mature and
    --   due to be repaid, or as a result of
    --   downgrade/bankruptcy is due to be repaid as a result
    --   of an acceleration clause. ISDA 2003 Term:
    --   Accelerated or Matured.
  notBearer : Optional Bool
    -- ^ A deliverable obligation characteristic. Any
    --   obligation that is not a bearer instrument. This
    --   applies to Bonds only and is meant to avoid tax,
    --   fraud and security/delivery provisions that can
    --   potentially be associated with Bearer Bonds. ISDA
    --   2003 Term: Not Bearer.
  fullFaithAndCreditObLiability : Optional Bool
    -- ^ An obligation and deliverable obligation
    --   characteristic. Defined in the ISDA published
    --   additional provisions for U.S. Municipal as Reference
    --   Entity. ISDA 2003 Term: Full Faith and Credit
    --   Obligation Liability.
  generalFundObligationLiability : Optional Bool
    -- ^ An obligation and deliverable obligation
    --   characteristic. Defined in the ISDA published
    --   additional provisions for U.S. Municipal as Reference
    --   Entity. ISDA 2003 Term: General Fund Obligation
    --   Liability.
  revenueObligationLiability : Optional Bool
    -- ^ An obligation and deliverable obligation
    --   characteristic. Defined in the ISDA published
    --   additional provisions for U.S. Municipal as Reference
    --   Entity. ISDA 2003 Term: Revenue Obligation Liability.
  indirectLoanParticipation : Optional LoanParticipation
    -- ^ ISDA 1999 Term: Indirect Loan Participation. NOTE:
    --   Only applicable as a deliverable obligation under
    --   ISDA Credit 1999.
  excluded : Optional Text
    -- ^ A free format string to specify any excluded
    --   obligations or deliverable obligations, as the case
    --   may be, of the reference entity or excluded types of
    --   obligations or deliverable obligations. ISDA 2003
    --   Term: Excluded Obligations/Excluded Deliverable
    --   Obligations.
  othReferenceEntityObligations : Optional Text
    -- ^ This element is used to specify any other obligations
    --   of a reference entity in both obligations and
    --   deliverable obligations. The obligations can be
    --   specified free-form. ISDA 2003 Term: Other
    --   Obligations of a Reference Entity.
    deriving (Eq, Ord, Show)

-- | A class to specify the application of Interest Amount
--   with respect the Delivery Amount.
data DeliveryAmount = DeliveryAmount with 
  standardElection : Optional DeliveryAmountElectionEnum
    -- ^ The standard election as specified by an enumeration.
  customElection : Optional Text
    -- ^ The custom election that might be specified by the
    --   parties to the agreement.
    deriving (Eq, Ord, Show)

-- | Specifies a specific date or the parameters for
--   identifying the relevant contract date when the
--   commodity reference price is a futures contract.
data DeliveryDateParameters = DeliveryDateParameters with 
  deliveryNearby : Optional Offset
    -- ^ Provides a container for the parametric
    --   representation that specifies which nearby contract
    --   date would be used as a refrence for a price.
  deliveryDate : Optional AdjustableDate
    -- ^ Specifies the specific contract date for the contract
    --   that should be referenced for a price.
  deliveryDateRollConvention : Optional Offset
    -- ^ Specifies, for a Commodity Transaction that
    --   references a listed future, the day on which the
    --   specified future will roll to the next nearby month
    --   prior to the expiration of the referenced future. If
    --   the future will not roll at all - i.e. the price will
    --   be taken from the expiring contract, 0 days should be
    --   specified here. If the future will roll to the next
    --   nearby on the last trading day - i.e. the price will
    --   be taken from the next nearby on the last trading
    --   day, then 1 business day should be specified and so
    --   on.
  deliveryDateExpirationConvention : Optional Offset
    -- ^ Specifies, for a Commodity Transaction that
    --   references a listed future, the day on which the
    --   specified future will expire ahead of the actual
    --   expiration of the referenced future. For example: Z21
    --   Contract expires on 19Nov21, with an adjust of 2D the
    --   'expire' will be 16Nov21.
    --   DeliveryDateRollConvention takes precedence. Example:
    --   Pricing on the Z21 Contract with NearbyContractDay
    --   and a deliveryDateRoll of 10D, Sampling of the F22
    --   Contract will occur on 8Nov21 through the last Date
    --   of the Z21 Contract. With an ExpConvention of 5D, the
    --   last sampling date on the F22 contract will be
    --   12Nov21.
    deriving (Eq, Ord, Show)

data DerivInstrmAttrbts = DerivInstrmAttrbts with 
  xpryDt : Text
  pricMltplr : Text
  undrlygInstrm : UndrlygInstrm
  dlvryTp : Text
    deriving (Eq, Ord, Show)

-- | Specifies the method according to which an amount or
--   a date is determined.
data DeterminationMethodology = DeterminationMethodology with 
  determinationMethod : Optional DeterminationMethodEnum
    -- ^ Represents a more granular dimention of observation.
    --   Typically relevent for resolving a unique equity
    --   price, which can be expressed as trade-weighted or
    --   volume-weighted averages.
  averagingMethod : Optional AveragingCalculationMethodEnum
    -- ^ Specifies enumerations for the type of averaging
    --   calculation.
    deriving (Eq, Ord, Show)

-- | Defines the roles and related terms which document
--   the agreement of parties about any determination
--   requirements ; mostly about Extraordinary Events,
--   without being necessarily restricted to such scope,
--   as further specified in the particular product at
--   stake e.g. for instance when Calculation Agent is
--   mentioned as the Price Determination Method
--   enumarated value, etc.
data DeterminationRolesAndTerms = DeterminationRolesAndTerms with 
    deriving (Eq, Ord, Show)

-- | An Asset that exists only in digital form, eg Bitcoin
--   or Ethereum, that is not backed by other Assets;
--   excludes the digital representation of other Assets,
--   eg coins or Tokenised assets.
data DigitalAsset = DigitalAsset with 
  identifier : [AssetIdentifier]
    -- ^ Asset Identifiers are used to uniquely identify an
    --   Asset, using a specified Asset Identifier Type.
  taxonomy : [Taxonomy]
    -- ^ Defines the taxonomy of an object by combining a
    --   taxonomy source (i.e. the rules to classify the
    --   object) and a value (i.e. the output of those rules
    --   on the object.
  isExchangeListed : Optional Bool
    -- ^ Defines whether the Asset is listed on a public
    --   exchange.
  exchange : Optional LegalEntity
    -- ^ If the Asset is listed, defines the public exchange
    --   of the listing.
  relatedExchange : [LegalEntity]
    -- ^ Provides the related Exchanges, if applicable.
    deriving (Eq, Ord, Show)

-- | A data defining:  discounting information. The 2000
--   ISDA definitions, section 8.4. discounting (related
--   to the calculation of a discounted fixed amount or
--   floating amount) apply. This type must only be
--   included if discounting applies.
data DiscountingMethod = DiscountingMethod with 
  discountingType : DiscountingTypeEnum
    -- ^ The discounting method that is applicable.
  discountRate : Optional Decimal
    -- ^ A discount rate, expressed as a decimal, to be used
    --   in the calculation of a discounted amount. A discount
    --   amount of 5% would be represented as 0.05.
  discountRateDayCountFraction : Optional (FieldWithMeta DayCountFractionEnum)
    -- ^ A discount day count fraction to be used in the
    --   calculation of a discounted amount.
    deriving (Eq, Ord, Show)

-- | A class to specify the Distributions and Interest
--   Payment provisions applicable to the collateral
--   agreement.
data DistributionAndInterestPayment = DistributionAndInterestPayment with 
  interestParameters : [CollateralInterestParameters]
    -- ^ Represents the interest parameters for the various
    --   currencies, margin types, posting parties.
    deriving (Eq, Ord, Show)

-- | The parameters which define whether dividends are
--   applicable
data DividendApplicability = DividendApplicability with 
  optionsExchangeDividends : Optional Bool
    -- ^ If present and true, then options exchange dividends
    --   are applicable.
  additionalDividends : Optional Bool
    -- ^ If present and true, then additional dividends are
    --   applicable.
  allDividends : Optional Bool
    -- ^ Represents the European Master Confirmation value of
    --   'All Dividends' which, when applicable,
    --   signifies that, for a given Ex-Date, the daily
    --   observed Share Price for that day is adjusted
    --   (reduced) by the cash dividend and/or the cash value
    --   of any non cash dividend per Share (including
    --   Extraordinary Dividends) declared by the Issuer. All
    --   Dividends in accordance with the ISDA 2002 Equity
    --   Derivatives Definitions.
    deriving (Eq, Ord, Show)

-- | A class to specify the currency in which the
--   dividends will be denominated, i.e. either in the
--   dividend currency or in a currency specified as part
--   of the contract.
data DividendCurrency = DividendCurrency with 
  currency : Optional (FieldWithMeta Text)
    -- ^ The currency in which the dividend is denominated.
    --   The list of valid currencies is not presently
    --   positioned as an enumeration as part of the CDM
    --   because that scope is limited to the values specified
    --   by ISDA and FpML. As a result, implementers have to
    --   make reference to the relevant standard, such as the
    --   ISO 4217 standard for currency codes.
  determinationMethod : Optional DeterminationMethodEnum
    -- ^ Specifies the method according to which the dividend
    --   is determined, e.g. the dividend currency.
  currencyReference : Optional (BasicReferenceWithMeta Text)
    -- ^ Reference to a currency specified elsewhere in the
    --   document
    deriving (Eq, Ord, Show)

-- | A class to specify the dividend date by reference to
--   another date, with the ability to apply and offset.
--   This class doesn't exist in FpML and is meant to
--   simplify the choice constraint associated with the
--   DividendPaymentDate class.
data DividendDateReference = DividendDateReference with 
  dateReference : DividendDateReferenceEnum
    -- ^ Specification of the dividend date using an
    --   enumeration, with values such as the pay date, the
    --   ex-date or the record date.
  paymentDateOffset : Optional Offset
    -- ^ Only to be used when SharePayment has been specified
    --   in the dividendDateReference element. The number of
    --   Currency Business Days following the day on which the
    --   Issuer of the Shares pays the relevant dividend to
    --   holders of record of the Shares.
    deriving (Eq, Ord, Show)

-- | A class describing the date on which the dividend
--   will be paid/received. This class is also used to
--   specify the date on which the FX rate will be
--   determined, when applicable.
data DividendPaymentDate = DividendPaymentDate with 
  dividendDateReference : Optional DividendDateReference
  dividendDate : Optional (ReferenceWithMeta AdjustableOrRelativeDate)
    deriving (Eq, Ord, Show)

-- | A class describing the dividend payout ratio
--   associated with an equity underlier. In certain cases
--   the actual ratio is not known on trade inception, and
--   only general conditions are then specified.
data DividendPayoutRatio = DividendPayoutRatio with 
  totalRatio : Decimal
    -- ^ Specifies the total actual dividend payout ratio
    --   associated with the equity underlier. A ratio of 90%
    --   should be expressed at 0.90.
  cashRatio : Optional Decimal
    -- ^ Specifies the cash actual dividend payout ratio
    --   associated with the equity underlier. A ratio of 90%
    --   should be expressed at 0.90.
  nonCashRatio : Optional Decimal
    -- ^ Specifies the non cash actual dividend payout ratio
    --   associated with the equity underlier. A ratio of 90%
    --   should be expressed at 0.90.
  basketConstituent : Optional (ReferenceWithMeta BasketConstituent)
    -- ^ In the case of a basket underlier, specifies to which
    --   component of the basket this particular set of
    --   dividend payout ratios correspond.
    deriving (Eq, Ord, Show)

-- | Time bounded dividend payment periods, each with a
--   dividend payment date per period.
data DividendPeriod = DividendPeriod with 
  startDate : Optional DividendPaymentDate
    -- ^ Dividend period start date.
  endDate : Optional DividendPaymentDate
    -- ^ Dividend period end date.
  dateAdjustments : BusinessDayAdjustments
    -- ^ Date adjustments for all unadjusted dates in this
    --   dividend period.
  basketConstituent : Optional (ReferenceWithMeta BasketConstituent)
    -- ^ For basket underliers, reference to the basket
    --   component which is paying dividends in the specified
    --   period.
  dividendPaymentDate : DividendPaymentDate
    -- ^ Specifies when the dividend will be paid to the
    --   receiver of the equity return. Has the meaning as
    --   defined in the ISDA 2002 Equity Derivatives
    --   Definitions. Is not applicable in the case of a
    --   dividend reinvestment election.
  dividendValuationDate : Optional AdjustableOrRelativeDate
    -- ^ Specifies the dividend valuation dates of the swap.
    deriving (Eq, Ord, Show)

-- | A class describing the conditions governing the
--   payment of dividends to the receiver of the equity
--   return, with the exception of the dividend payout
--   ratio, which is defined for each of the underlying
--   components.
data DividendReturnTerms = DividendReturnTerms with 
  dividendPayoutRatio : [DividendPayoutRatio]
    -- ^ Specifies the dividend payout ratio associated with
    --   each underlier. In FpML 5.10 the payout is positioned
    --   at the underlier level, although there is an intent
    --   to reconsider this approach and position it at the
    --   leg level. This is approach adopted by the CDM.
  dividendReinvestment : Optional Bool
    -- ^ Boolean element that defines whether the dividend
    --   will be reinvested or not.
  dividendEntitlement : Optional DividendEntitlementEnum
    -- ^ Defines the date on which the receiver of the equity
    --   return is entitled to the dividend.
  dividendAmountType : Optional DividendAmountTypeEnum
    -- ^ Specifies whether the dividend is paid with respect
    --   to the Dividend Period.
  performance : Optional Text
    -- ^ Performance calculation, in accordance with Part 1
    --   Section 12 of the 2018 ISDA CDM Equity Confirmation
    --   for Security Equity Swap, Para 75. 'Equity
    --   Performance'. Cumulative performance is used as a
    --   notional multiplier factor on both legs of an Equity
    --   Swap.
  firstOrSecondPeriod : Optional DividendPeriodEnum
    -- ^ 2002 ISDA Equity Derivatives Definitions: Dividend
    --   Period as either the First Period or the Second
    --   Period. | 
  extraordinaryDividendsParty : Optional AncillaryRoleEnum
    -- ^ Specifies the party which determines if dividends are
    --   extraordinary in relation to normal levels.
  excessDividendAmount : Optional DividendAmountTypeEnum
    -- ^ Determination of Gross Cash Dividend per Share.
  dividendCurrency : Optional DividendCurrency
    -- ^ Specifies the currency in which the dividend will be
    --   denominated, e.g. the dividend currency, or a
    --   specified currency. This class is not specified as
    --   such in FpML, which makes use of the
    --   CurrencyAndDeterminationMethod.model to specify such
    --   terms.
  nonCashDividendTreatment : Optional NonCashDividendTreatmentEnum
    -- ^ Specifies the treatment of Non-Cash Dividends.
  dividendComposition : Optional DividendCompositionEnum
    -- ^ Specifies how the composition of Dividends is to be
    --   determined.
  specialDividends : Optional Bool
    -- ^ Specifies the method according to which special
    --   dividends are determined.
  materialDividend : Optional Bool
    -- ^ If present and true, then material non cash dividends
    --   are applicable.
  dividendPeriod : [DividendPeriod]
    -- ^ One to many time bounded dividend payment periods,
    --   each with a dividend payment date per period.
    deriving (Eq, Ord, Show)

-- | Information related to dividends and payments.
data DividendTerms = DividendTerms with 
  manufacturedIncomeRequirement : DividendPayoutRatio
    -- ^ Specifies the proportion of the value of the dividend
    --   on the borrowed shares that the borrower is legally
    --   obligated to return to the lender.
  dividendEntitlement : Optional DividendEntitlementEnum
    -- ^ Defines the date on which the receiver of the equity
    --   return is entitled to the dividend.
  minimumBillingAmount : Optional Money
    -- ^ daily fee increments accrue until a threshold is
    --   crossed, at which point payment becomes due)
    deriving (Eq, Ord, Show)

data Document = Document with 
  finInstrmRptgTxRpt : FinInstrmRptgTxRpt
    deriving (Eq, Ord, Show)

-- | A data to:  define the adjusted dates associated with
--   an early termination provision.
data EarlyTerminationEvent = EarlyTerminationEvent with 
  adjustedExerciseDate : Date
    -- ^ The date on which option exercise takes place. This
    --   date should already be adjusted for any applicable
    --   business day convention.
  adjustedEarlyTerminationDate : Date
    -- ^ The early termination date that is applicable if an
    --   early termination provision is exercised. This date
    --   should already be adjusted for any applicable
    --   business day convention.
  adjustedCashSettlementValuationDate : Date
    -- ^ The date by which the cash settlement amount must be
    --   agreed. This date should already be adjusted for any
    --   applicable business day convention.
  adjustedCashSettlementPaymentDate : Date
    -- ^ The date on which the cash settlement amount is paid.
    --   This date should already be adjusted for any
    --   applicable business date convention.
  adjustedExerciseFeePaymentDate : Optional Date
    -- ^ The date on which the exercise fee amount is paid.
    --   This date should already be adjusted for any
    --   applicable business day convention.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A data defining:  an early termination provision for
--   a swap. This early termination is at fair value, i.e.
--   on termination the fair value of the product must be
--   settled between the parties.
data EarlyTerminationProvision = EarlyTerminationProvision with 
  mandatoryEarlyTermination : Optional MandatoryEarlyTermination
    -- ^ A mandatory early termination provision to terminate
    --   the swap at fair value.
  mandatoryEarlyTerminationDateTenor : Optional Period
    -- ^ Period after trade date of the mandatory early
    --   termination date.
  optionalEarlyTermination : Optional OptionalEarlyTermination
    -- ^ An option for either or both parties to terminate the
    --   swap at fair value.
  optionalEarlyTerminationParameters : Optional ExercisePeriod
    -- ^ Definition of the first early termination date and
    --   the frequency of the termination dates subsequent to
    --   that. American exercise is defined by having a
    --   frequency of one day.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | This class represents the full set of price-forming
--   features associated with a contractual product: the
--   payout component, the notional/quantity, the
--   effective and termination date and the date
--   adjustment provisions when applying uniformily across
--   the payout components. This class also includes the
--   legal provisions which have valuation implications:
--   cancelable provision, extendible provision, early
--   termination provision and extraordinary events
--   specification.
data EconomicTerms = EconomicTerms with 
  effectiveDate : Optional AdjustableOrRelativeDate
    -- ^ The first day of the terms of the trade. This day may
    --   be subject to adjustment in accordance with a
    --   business day convention.
  terminationDate : Optional AdjustableOrRelativeDate
    -- ^ The last day of the terms of the trade. This date may
    --   be subject to adjustments in accordance with the
    --   business day convention. It can also be specified in
    --   relation to another scheduled date (e.g. the last
    --   payment date).
  dateAdjustments : Optional BusinessDayAdjustments
    -- ^ The business day adjustment convention when it
    --   applies across all the payout components. This
    --   specification of the business day convention and
    --   financial business centers is used for adjusting any
    --   calculation period date if it would otherwise fall on
    --   a day that is not a business day in the specified
    --   business center.
  payout : [Payout]
    -- ^ The payout specifies the future cashflow computation
    --   methodology which characterizes a financial product.
  terminationProvision : Optional TerminationProvision
    -- ^ Contains optional provisions pertaining to the
    --   termination characteristics of a contract.
  calculationAgent : Optional CalculationAgent
    -- ^ The ISDA calculation agent responsible for performing
    --   duties as defined in the applicable product
    --   definitions.
  nonStandardisedTerms : Optional Bool
    -- ^ Specifies, when boolean value is True, that
    --   additional economic terms exist that have not been
    --   included in the product representation.
  collateral : Optional Collateral
    -- ^ Represents the collateral obligations of a party.
    deriving (Eq, Ord, Show)

-- | Query to check against an
--   EligibleCollateralSpecification
data EligibilityQuery = EligibilityQuery with 
  maturity : Decimal
    -- ^ Maturity in years
  collateralAssetType : AssetType
    -- ^ The asset product type.
  assetCountryOfOrigin : ISOCountryCodeEnum
    -- ^ The asset country of origin.
  denominatedCurrency : CurrencyCodeEnum
    -- ^ The underlying asset denominated currency.
  agencyRating : AgencyRatingCriteria
    -- ^ The agency rating based on default risk and creditors
    --   claim in event of default associated with specific
    --   instrument.
  issuerType : CollateralIssuerType
    -- ^ Represents a filter based on the type of entity
    --   issuing the asset.
  issuerName : LegalEntity
    -- ^ Specifies the issuing entity name or LEI.
    deriving (Eq, Ord, Show)

-- | Represents a set of criteria used to specify eligible
--   collateral.
data EligibleCollateralCriteria = EligibleCollateralCriteria with 
  issuer : [IssuerCriteria]
    -- ^ Represents a filter based criteria related to the
    --   issuer.
  asset : [AssetCriteria]
    -- ^ Represents a filter based on the criteria related to
    --   the asset.
  appliesTo : [CounterpartyRoleEnum]
    -- ^ Specifies which of the two counterparties the
    --   criteria applies to (either one or both
    --   counterparties). This attribute is optional, in case
    --   the applicable party is already specified elsewhere
    --   within a party election.
  restrictTo : Optional CollateralMarginTypeEnum
    -- ^ Restrict the criteria to only apply to a specific
    --   type of margin, ie IM or VM.
  ratingPriorityResolution : Optional RatingPriorityResolutionEnum
    -- ^ Denotes which Criteria has priority if more than one
    --   agency rating applies.
  treatment : CollateralTreatment
    -- ^ Identifies the treatment of specified collateral,
    --   e.g., haircuts,holding limits or exclusions.
    deriving (Eq, Ord, Show)

-- | Represents a set of criteria used to specify eligible
--   collateral.
data EligibleCollateralSpecification = EligibleCollateralSpecification with 
  identifier : [Identifier]
    -- ^ Specifies the identifier(s) to uniquely identify
    --   eligible collateral or a set of eligible collateral,
    --   such as a schedule or equivalant for an identity
    --   issuer.
  party : [Party]
    -- ^ The parties associated with the specification.
  counterparty : [Counterparty]
    -- ^ Specification of the roles of the counterparties to
    --   the specification.
  criteria : [EligibleCollateralCriteria]
    -- ^ Represents a set of criteria used to specify eligible
    --   collateral.
  partyRole : [PartyRole]
    -- ^ Specifies the role(s) that each of the party(s) is
    --   playing in the context of the specification, eg Payor
    --   or Receiver.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

data EligibleCollateralSpecificationInstruction = EligibleCollateralSpecificationInstruction with 
  common : EligibleCollateralCriteria
  variable : [EligibleCollateralCriteria]
    deriving (Eq, Ord, Show)

-- | Transaction AdditionalTerms that apply to Equity
--   asset class.
data EquityAdditionalTerms = EquityAdditionalTerms with 
  extraordinaryEvents : Optional ExtraordinaryEvents
  determinationTerms : [DeterminationRolesAndTerms]
  substitutionProvision : Optional UnderlierSubstitutionProvision
    deriving (Eq, Ord, Show)

-- | A class for defining the merger events and their
--   treatment.
data EquityCorporateEvents = EquityCorporateEvents with 
    deriving (Eq, Ord, Show)

-- | Specification of an index based on equity securities,
--   e.g. the S&P 500..
data EquityIndex = EquityIndex with 
  identifier : [AssetIdentifier]
    -- ^ Asset Identifiers are used to uniquely identify an
    --   Asset, using a specified Asset Identifier Type.
  taxonomy : [Taxonomy]
    -- ^ Defines the taxonomy of an object by combining a
    --   taxonomy source (i.e. the rules to classify the
    --   object) and a value (i.e. the output of those rules
    --   on the object.
  isExchangeListed : Optional Bool
    -- ^ Defines whether the Asset is listed on a public
    --   exchange.
  exchange : Optional LegalEntity
    -- ^ If the Asset is listed, defines the public exchange
    --   of the listing.
  relatedExchange : [LegalEntity]
    -- ^ Provides the related Exchanges, if applicable.
  name : Optional (FieldWithMeta Text)
    -- ^ A description of the Index.
  provider : Optional LegalEntity
    -- ^ The organisation that creates or maintains the Index.
  assetClass : Optional AssetClassEnum
    -- ^ The Asset Class of the Index.
    deriving (Eq, Ord, Show)

-- | Specification for General Terms and Elections of an
--   Equity Master Confirmation that is applicable across
--   multiple Equity confirmations and is referenced by
--   each of these confirmations, an example of which
--   being the 2018 ISDA CDM Equity Confirmation for
--   Security Equity Swap.
data EquityMasterConfirmation = EquityMasterConfirmation with 
    deriving (Eq, Ord, Show)

-- | Specification for the General Terms and Relationship
--   Supplement Elections as provided in the 2018 ISDA CDM
--   Equity Confirmation for Security Equity Swap.
data EquitySwapMasterConfirmation2018 = EquitySwapMasterConfirmation2018 with 
  typeOfSwapElection : ReturnTypeEnum
    -- ^ Per Part 1 Section 4, 'Dividend Obligations',
    --   of the 2018 ISDA CDM Equity Confirmation, Para 4.2
    --   'Dividend Returns'
  pricingMethodElection : PriceReturnTerms
    -- ^ Per Part 1 Section 5, 'Pricing', of the 2018
    --   ISDA CDM Equity Confirmation, Para 5.1
  linearInterpolationElection : InterpolationMethodEnum
    -- ^ Per Part 1 Section 3, 'Floating Obligations',
    --   of the 2018 ISDA CDM Equity Confirmation. Para 3.3
  settlementTerms : SettlementTerms
    -- ^ Per Part 1 Section 8, 'Settlement', of the
    --   2018 ISDA CDM Equity Confirmation for Security Equity
    --   Swap
  valuationDates : ValuationDates
    -- ^ The parameters used to generate the 'Equity
    --   Valuation Dates' schedule, including the
    --   Effective Date and Termination Date for the Swap.
  equityCashSettlementDates : PaymentDates
    -- ^ The parameters used to generate the payment date
    --   schedule, relative to the equityCalculationPeriod.
    --   Per Part 1 Section 12, 'Definitions', of the
    --   2018 ISDA CDM Equity Confirmation. Para 73
    deriving (Eq, Ord, Show)

data EquityUnderlierProvisions = EquityUnderlierProvisions with 
  multipleExchangeIndexAnnexFallback : Optional Bool
    -- ^ For an index option or swap transaction, a flag to
    --   indicate whether a relevant Multiple Exchange Index
    --   Annex is applicable to the transaction. This annex
    --   defines additional provisions which are applicable
    --   where an index is comprised of component securities
    --   that are traded on multiple exchanges.
  componentSecurityIndexAnnexFallback : Optional Bool
    -- ^ For an index option or swap transaction, a flag to
    --   indicate whether a relevant Component Security Index
    --   Annex is applicable to the transaction.
  localJurisdiction : Optional (FieldWithMeta Text)
    -- ^ The ISO 3166 standard code for the country within
    --   which the postal address is located.
  relevantJurisdiction : Optional (FieldWithMeta Text)
    -- ^ The ISO 3166 standard code for the country within
    --   which the postal address is located.
    deriving (Eq, Ord, Show)

-- | Specifies instructions to create a BusinessEvent.
data EventInstruction = EventInstruction with 
  intent : Optional EventIntentEnum
    -- ^ The intent attribute is meant to be specified when
    --   the event qualification cannot be programmatically
    --   inferred from the event features. As a result it is
    --   only associated with those primitives that can give
    --   way to such ambiguity, the quantityChange being one
    --   of those. An example of such is a reduction in the
    --   trade notional, which could be interpreted as either
    --   a trade correction (unless a maximum period of time
    --   post-event is specified as part of the
    --   qualification), a partial termination or a portfolio
    --   rebalancing in the case of an equity swap. On the
    --   other hand, an event such as the exercise is not
    --   expected to have an associated intent as there should
    --   not be ambiguity.
  corporateActionIntent : Optional CorporateActionTypeEnum
  eventDate : Optional Date
    -- ^ Specifies the date on which the event is taking
    --   place. This date is equal to the trade date in the
    --   case of a simple execution.  However it can be
    --   different from the trade date, for example in the
    --   case of a partial termination.
  effectiveDate : Optional Date
    -- ^ The date on which the event contractually takes
    --   effect, when different from the event date.
  packageInformation : Optional IdentifiedList
    -- ^ Specifies the package information in case the
    --   business event represents several trades executed as
    --   a package (hence this attribute is optional). The
    --   package information is only instantiated once at the
    --   business event level to preserve referential
    --   integrity, whereas individual trades make reference
    --   to it to identify that they are part of a package.
  instruction : [Instruction]
    -- ^ Specifies the instructions to create the Business
    --   Event.
    deriving (Eq, Ord, Show)

-- | A class to represent the various set of timestamps
--   that can be associated with lifecycle events, as a
--   collection of [dateTime, qualifier].
data EventTimestamp = EventTimestamp with 
  dateTime : ZonedDateTime
    -- ^ The CDM specifies that the zoned date time is to be
    --   expressed in accordance with ISO 8601, either as UTC
    --   as an offset to UTC.
  qualification : EventTimestampQualificationEnum
    -- ^ The timestamp qualifier is specified through an
    --   enumeration because the experience of integrating the
    --   DTCC and CME data representations suggests that a
    --   wide set of timestamps are currently utilized among
    --   service providers, while there is not at present an
    --   objective set of criteria that could help suggest a
    --   defined set of timestamps as part of the CDM. At some
    --   future point, one possible baseline could be
    --   developed from the review of the set of timestamps
    --   specified across regulatory regimes and regulations
    --   (incl. regulations such as high frequency trading).
    --   Also, the integration with a further set of
    --   implementations and the specification of business
    --   workflows such as clearing as part of the CDM
    --   development should help confirm the implementation
    --   approach in this respect.
    deriving (Eq, Ord, Show)

-- | Specifies a transaction which automatically extends
--   for a specified timeframe until the exercise of an
--   embedded option.
data EvergreenProvision = EvergreenProvision with 
  singlePartyOption : Optional PartyRole
    -- ^ If evergreen termination is not available to both
    --   parties then this component specifies the buyer and
    --   seller of the option.
  noticePeriod : RelativeDateOffset
    -- ^ The length of each evergreen extension period
    --   relative to the effective date of the preceding
    --   contract.
  noticeDeadlinePeriod : Optional RelativeDateOffset
    -- ^ Defines the minimum period before an evergreen is
    --   scheduled to terminate that notice can be given that
    --   it will terminate beyond the scheduled termination
    --   date.
  noticeDeadlineDateTime : Optional ZonedDateTime
    -- ^ A specific date and time for the notice deadline
  extensionFrequency : AdjustableRelativeOrPeriodicDates
    -- ^ The frequency with which the evergreen contract will
    --   be extended if notice is not given.
  finalPeriodFeeAdjustment : Optional Price
    -- ^ An optional adjustment to the rate for the last
    --   period of the evergreen i.e. the period from when
    --   notice is given to stop rolling the contract through
    --   to the termination date.
    deriving (Eq, Ord, Show)

data ExctgPrsn = ExctgPrsn with 
  prsn : Prsn
    deriving (Eq, Ord, Show)

-- | Defines specific attributes that relate to trade
--   executions.
data ExecutionDetails = ExecutionDetails with 
  executionType : ExecutionTypeEnum
    -- ^ Identifies the type of execution, e.g. via voice,
    --   electronically...
  executionVenue : Optional LegalEntity
    -- ^ Represents the venue on which a trade was executed.
  packageReference : Optional IdentifiedList
    -- ^ A reference to the package linking the trade with
    --   other trades, in case the trade was executed as part
    --   of a package (hence this attribute is optional).
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | Specifies instructions for execution of a
--   transaction, consisting of a product, price,
--   quantity, parties, trade identifier, execution
--   details, and settlement terms.
data ExecutionInstruction = ExecutionInstruction with 
  product : NonTransferableProduct
    -- ^ Defines the financial product to be executed and
    --   contract formed.
  priceQuantity : [PriceQuantity]
    -- ^ Defines the prices (e.g. spread, equity price, FX
    --   rate), quantities (e.g. currency amount, no. shares)
    --   and settlement terms (e.g. initial fee, broker fee,
    --   up-front cds payment or option premium settlement)
    --   associated with the constituents of the transacted
    --   product.
  counterparty : [Counterparty]
    -- ^ Maps two defined parties to counterparty enums for
    --   the transacted product.
  ancillaryParty : [AncillaryParty]
    -- ^ Maps any ancillary parties, e.g. parties involved in
    --   the transaction that are not one of the two principal
    --   parties.
  parties : [Party]
    -- ^ Defines all parties to that execution, including
    --   agents and brokers.
  partyRoles : [PartyRole]
    -- ^ Defines the role(s) that party(ies) may have in
    --   relation to the execution.
  executionDetails : ExecutionDetails
    -- ^ Specifies the type and venue of execution, e.g. via
    --   voice, or electronically.
  tradeDate : (FieldWithMeta Date)
    -- ^ Denotes the trade/execution date.
  tradeTime : Optional (FieldWithMeta TimeZone)
    -- ^ Denotes the trade time and timezone as agreed by the
    --   parties to the trade.
  tradeIdentifier : [TradeIdentifier]
    -- ^ Denotes one or more identifiers associated with the
    --   transaction.
  collateral : Optional Collateral
    -- ^ Detail the collateral requirement anticipated with
    --   the transaction.
  lotIdentifier : Optional Identifier
    -- ^ Lot Identifier associated with the transaction.
    deriving (Eq, Ord, Show)

-- | A data defining:  the adjusted dates associated with
--   a particular exercise event.
data ExerciseEvent = ExerciseEvent with 
  adjustedExerciseDate : Date
    -- ^ The date on which the option exercise takes place.
    --   This date should already be adjusted for any
    --   applicable business day convention.
  adjustedRelevantSwapEffectiveDate : Date
    -- ^ The effective date of the underlying swap associated
    --   with a given exercise date. This date should already
    --   be adjusted for any applicable business day
    --   convention.
  adjustedCashSettlementValuationDate : Optional Date
    -- ^ The date by which the cash settlement amount must be
    --   agreed. This date should already be adjusted for any
    --   applicable business day convention.
  adjustedCashSettlementPaymentDate : Optional Date
    -- ^ The date on which the cash settlement amount is paid.
    --   This date should already be adjusted for any
    --   applicable business day convention.
  adjustedExerciseFeePaymentDate : Optional Date
    -- ^ The date on which the exercise fee amount is paid.
    --   This date should already be adjusted for any
    --   applicable business day convention.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A class defining the fee payable on exercise of an
--   option. This fee may be defined as an amount or a
--   percentage of the notional exercised. As a difference
--   with FpML, it extends the BuyerSeller class.
data ExerciseFee = ExerciseFee with 
  payer : CounterpartyRoleEnum
    -- ^ Specifies the counterparty responsible for making the
    --   payments defined by this structure.  The party is one
    --   of the two principal parties to the transaction.
  receiver : CounterpartyRoleEnum
    -- ^ Specifies the party that receives the payments
    --   corresponding to this structure.  The party is one of
    --   the two counterparties to the transaction.
  notionalReference : (ReferenceWithMeta Money)
    -- ^ A pointer style reference to the associated notional
    --   schedule defined elsewhere in the document.
  feeAmount : Optional Decimal
    -- ^ The amount of fee to be paid on exercise. The fee
    --   currency is that of the referenced notional.
  feeRate : Optional Decimal
    -- ^ A fee represented as a percentage of some referenced
    --   notional. A percentage of 5% would be represented as
    --   0.05.
  feePaymentDate : RelativeDateOffset
    -- ^ The date on which exercise fee(s) will be paid. It is
    --   specified as a relative date.
    deriving (Eq, Ord, Show)

-- | A class to define a fee or schedule of fees to be
--   payable on the exercise of an option. This fee may be
--   defined as an amount or a percentage of the notional
--   exercised. As a difference with FpML, it extends the
--   BuyerSeller class.
data ExerciseFeeSchedule = ExerciseFeeSchedule with 
  payer : CounterpartyRoleEnum
    -- ^ Specifies the counterparty responsible for making the
    --   payments defined by this structure.  The party is one
    --   of the two principal parties to the transaction.
  receiver : CounterpartyRoleEnum
    -- ^ Specifies the party that receives the payments
    --   corresponding to this structure.  The party is one of
    --   the two counterparties to the transaction.
  notionalReference : (ReferenceWithMeta Money)
    -- ^ A pointer style reference to the associated notional
    --   schedule defined elsewhere in the document.
  feeAmountSchedule : Optional AmountSchedule
    -- ^ The exercise fee amount schedule. The fees are
    --   expressed as currency amounts. The currency of the
    --   fee is assumed to be that of the notional schedule
    --   referenced.
  feeRateSchedule : Optional Schedule
    -- ^ The exercise free rate schedule. The fees are
    --   expressed as percentage rates of the notional being
    --   exercised. The currency of the fee is assumed to be
    --   that of the notional schedule referenced.
  feePaymentDate : RelativeDateOffset
    -- ^ The date on which exercise fee(s) will be paid. It is
    --   specified as a relative date.
    deriving (Eq, Ord, Show)

-- | Specifies the information required to communicate the
--   choices made by the exercising party, in a financial
--   product endowing the party with at least one option.
data ExerciseInstruction = ExerciseInstruction with 
  exerciseQuantity : PrimitiveInstruction
    -- ^ Contains instructions for exercising the option
    --   including a quantity change, and optionally a
    --   transfer.
  exerciseOption : Optional (ReferenceWithMeta OptionPayout)
    -- ^ Specifies the Option Payout being exercised on the
    --   trade.
  exerciseDate : Optional AdjustableOrAdjustedDate
    -- ^ Specifies the date on which an option contained
    --   within the financial product would be exercised. The
    --   date may be omitted if the contractual product allows
    --   for only a single date of exercise (European
    --   exercise).
  exerciseTime : Optional BusinessCenterTime
    -- ^ Specifies the time at which an option contained
    --   within the financial product woulld be exercised. The
    --   time may be omitted if the contractual product allows
    --   for only a single time of exercise (European
    --   exercise). 
  replacementTradeIdentifier : [TradeIdentifier]
    -- ^ Specifies the trade identifier to apply to the
    --   replacement trade for physical exercise.
    deriving (Eq, Ord, Show)

-- | Defines to whom and where notice of execution should
--   be given. The exerciseNoticeGiver refers to one or
--   both of the principal parties of the trade. If
--   present the exerciseNoticeReceiver refers to a party,
--   other than the principal party, to whom notice should
--   be given.
data ExerciseNotice = ExerciseNotice with 
  exerciseNoticeGiver : ExerciseNoticeGiverEnum
    -- ^ Specifies the principal party of the trade that has
    --   the right to exercise.
  exerciseNoticeReceiver : Optional AncillaryRoleEnum
    -- ^ Specifies the party to which notice of exercise
    --   should be given, e.g. by the buyer of the option.
    --   Although in many cases it is the buyer of the option
    --   who sends the exercise notice to the seller of the
    --   option, this component is reused, e.g. in case of
    --   OptionEarlyTermination, either or both parties have
    --   the right to exercise.
  businessCenter : (FieldWithMeta BusinessCenterEnum)
    -- ^ Specifies the location where the exercise must be
    --   reported, e.g. where the exercise notice receiver is
    --   based.
    deriving (Eq, Ord, Show)

-- | This defines the time interval to the start of the
--   exercise period, i.e. the earliest exercise date, and
--   the frequency of subsequent exercise dates (if any).
data ExercisePeriod = ExercisePeriod with 
  earliestExerciseDateTenor : Period
    -- ^ The time interval to the first (and possibly only)
    --   exercise date in the exercise period.
  exerciseFrequency : Optional Period
    -- ^ The frequency of subsequent exercise dates in the
    --   exercise period following the earliest exercise date.
    --   An interval of 1 day should be used to indicate an
    --   American style exercise period.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A class describing how notice of exercise should be
--   given. This can be either manual or automatic.
data ExerciseProcedure = ExerciseProcedure with 
  manualExercise : Optional ManualExercise
    -- ^ Specifies that the notice of exercise must be given
    --   by the buyer to the seller or seller's agent.
  automaticExercise : Optional AutomaticExercise
    -- ^ If automatic is specified, then the notional amount
    --   of the underlying swap not previously exercised under
    --   the swaption will be automatically exercised at the
    --   expiration time on the expiration date if at such
    --   time the buyer is in-the-money, provided that the
    --   difference between the settlement rate and the fixed
    --   rate under the relevant underlying swap is not less
    --   than the specified threshold rate. The term
    --   in-the-money is assumed to have the meaning defining
    --   in the 2000 ISDA Definitions, Section 17.4
    --   In-the-money.
  followUpConfirmation : Bool
    -- ^ A flag to indicate whether follow-up confirmation of
    --   exercise (written or electronic) is required
    --   following telephonic notice by the buyer to the
    --   seller or seller's agent.
  limitedRightToConfirm : Optional Bool
    -- ^ Has the meaning defined as part of the 1997 ISDA
    --   Government Bond Option Definitions, section 4.5
    --   Limited Right to Confirm Exercise. If present, (i)
    --   the Seller may request the Buyer to confirm its
    --   intent if not done on or before the expiration time
    --   on the Expiration date (ii) specific rules will apply
    --   in relation to the settlement mode.
  splitTicket : Optional Bool
    -- ^ Typically applicable to the physical settlement of
    --   bond and convertible bond options. If present, means
    --   that the party required to deliver the bonds will
    --   divide those to be delivered as notifying party
    --   desires to facilitate delivery obligations.
    deriving (Eq, Ord, Show)

-- | A class defining the exercise period for an option
--   together with any rules governing the notional amount
--   of the underlying which can be exercised on any given
--   exercise date and any associated exercise fees.
data ExerciseTerms = ExerciseTerms with 
  style : Optional OptionExerciseStyleEnum
    -- ^ Whether the option has a single exercise (european),
    --   multiple exercise dates (bermuda), or a continuous
    --   range of exercise (american).
  commencementDate : Optional AdjustableOrRelativeDate
    -- ^ The first day of the exercise period for an American
    --   style option.
  exerciseDates : Optional AdjustableOrRelativeDates
    -- ^ The dates that define the Bermuda option exercise
    --   dates and the expiration date. The last specified
    --   date is assumed to be the expiration date. The dates
    --   can either be specified as a series of explicit dates
    --   and associated adjustments or as a series of dates
    --   defined relative to another schedule of dates, for
    --   example, the calculation period start dates. Where a
    --   relative series of dates are defined the first and
    --   last possible exercise dates can be separately
    --   specified.
  expirationDate : [AdjustableOrRelativeDate]
    -- ^ The last day within an exercise period for an
    --   American style option. For a European style option it
    --   is the only day within the exercise period.
  relevantUnderlyingDate : Optional AdjustableOrRelativeDates
    -- ^ The effective date on the underlying product if the
    --   option is exercised.  For example, for a swaption it
    --   is the swap effective date, for an option on an FX
    --   spot or forward it is the value date for settlement,
    --   and in an extendible/cancelable provision it is the
    --   swap termination date, which is the date on which the
    --   termination is effective.'
  earliestExerciseTime : Optional BusinessCenterTime
    -- ^ The earliest time at which notice of exercise can be
    --   given by the buyer to the seller (or seller's
    --   agent) to, and including, the expiration date.
  latestExerciseTime : Optional BusinessCenterTime
    -- ^ For a Bermuda or American style option, the latest
    --   time on an exercise business day (excluding the
    --   expiration date) within the exercise period that
    --   notice can be given by the buyer to the seller or
    --   seller's agent. Notice of exercise given after
    --   this time will be deemed to have been given on the
    --   next exercise business day.
  expirationTime : BusinessCenterTime
    -- ^ The latest time for exercise on expirationDate. It is
    --   made mandatory given that for all option styles, this
    --   field is required.
  expirationTimeType : Optional ExpirationTimeTypeEnum
    -- ^ The time of day at which the equity option expires,
    --   for example the official closing time of the
    --   exchange.
  multipleExercise : Optional MultipleExercise
    -- ^ As defined in the 2000 ISDA Definitions, Section
    --   12.4. Multiple Exercise, the buyer of the option has
    --   the right to exercise all or less than all the
    --   unexercised notional amount of the underlying swap on
    --   one or more days in the exercise period, but on any
    --   such day may not exercise less than the minimum
    --   notional amount or more that the maximum notional
    --   amount, and if an integral multiple amount is
    --   specified, the notional amount exercised must be
    --   equal to, or be an integral multiple of, the integral
    --   multiple amount.
  exerciseFeeSchedule : Optional ExerciseFeeSchedule
    -- ^ The fees associated with an exercise date. The fees
    --   are conditional on the exercise occurring. The fees
    --   can be specified as actual currency amounts or as
    --   percentages of the notional amount being exercised.
  exerciseProcedure : Optional ExerciseProcedure
    -- ^ The set of parameters defining the procedure
    --   associated with the exercise, e.g. manual exercise.
  exerciseFee : Optional ExerciseFee
    -- ^ A fee to be paid on exercise. This could be
    --   represented as an amount or a rate and notional
    --   reference on which to apply the rate.
  partialExercise : Optional PartialExercise
    -- ^ As defined in the 2000 ISDA Definitions, Section
    --   12.3. Partial Exercise, the buyer of the option has
    --   the right to exercise all or less than all the
    --   notional amount of the underlying swap on the
    --   expiration date, but may not exercise less than the
    --   minimum notional amount, and if an integral multiple
    --   amount is specified, the notional amount exercised
    --   must be equal to, or be an integral multiple of, the
    --   integral multiple amount.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | Represents the current mark to market value or IM
--   calculation value of the trade portfolio as recorded
--   by the principle (in base currency).
data Exposure = Exposure with 
  tradePortfolio : (ReferenceWithMeta PortfolioState)
    -- ^ Represents a Portfolio that describes all the
    --   positions held at a given time, in various states
    --   which can be either traded, settled, etc., with
    --   lineage information to the previous state.
  aggregateValue : Money
    -- ^ Represents the aggregate value of the portfolio in
    --   base currency.
  calculationDateTime : Optional ZonedDateTime
    -- ^ Indicates the date when the exposure is calculated if
    --   different from valuation date.
  valuationDateTime : ZonedDateTime
    -- ^ Indicates the valuation date of the exposure
    --   underlying the calculation.
    deriving (Eq, Ord, Show)

-- | A data defining:  an option to extend an existing
--   swap transaction on the specified exercise dates for
--   a term ending on the specified new termination date.
--   As a difference from FpML, it extends the BuyerSeller
--   class, which represents the BuyerSeller.model.
data ExtendibleProvision = ExtendibleProvision with 
  buyer : CounterpartyRoleEnum
    -- ^ Buyer party that can be resolved as one of the two
    --   principal parties to the transaction. The party that
    --   buys this instrument, i.e. pays for this instrument
    --   and receives the rights defined by it. ISDA 2002
    --   Equity Definitions section 1.18: `Buyer` means the
    --   party specified as such in the related Confirmation.
    --   | ISDA 2006 Definitions article 12.1 (b)(i) relating
    --   to a Swaption: 'Buyer' means the party that
    --   will, on each Premium Payment Date, pay to Seller the
    --   Premium | ISDA 2006 Definitions article 12.1 (b)(ii)
    --   relating to Swap Transactions with applicable Early
    --   Termination: the party specified as such in the
    --   related Confirmation, or the Exercising Party if
    --   neither party is specified | ISDA 2006 Definitions
    --   article 12.1 (b)(iii) relating to any other Option
    --   Transaction: the party specified as such in the
    --   related Confirmation. | ISDA 2014 Credit Definition
    --   article 1.4: `Buyer` means the Fixed Rate Payer.
  seller : CounterpartyRoleEnum
    -- ^ Seller party that can be resolved as one of the two
    --   principal parties to the transaction. The party that
    --   sells ('writes') this instrument, i.e. that
    --   grants the rights defined by this instrument and in
    --   return receives a payment for it. ISDA 2002 Equity
    --   Definitions section 1.19: `Seller` means the party
    --   specified as such in the related Confirmation. | ISDA
    --   2006 Definitions article 12.1 (a)(i) relating to a
    --   Swaption: 'Seller' means the party the party
    --   specified as such or as writer in the related
    --   Confirmation | ISDA 2006 Definitions article 12.1
    --   (a)(ii) relating to Swap Transactions with applicable
    --   Early Termination: the party specified as such or as
    --   writer in the related Confirmation or, if neither
    --   party is specified as such, the Non-exercising Party
    --   | ISDA 2006 Definitions article 12.1 (a)(iii)
    --   relating to any other Option Transaction: the party
    --   specified as such in the related Confirmation. | ISDA
    --   2014 Credit Definition article 1.4: `Seller` means
    --   the Floating Rate Payer.
  exerciseNotice : Optional ExerciseNotice
    -- ^ Definition of the party to whom notice of exercise
    --   should be given.
  followUpConfirmation : Optional Bool
    -- ^ A flag to indicate whether follow-up confirmation of
    --   exercise (written or electronic) is required
    --   following telephonic notice by the buyer to the
    --   seller or seller's agent.
  extendibleProvisionAdjustedDates : Optional ExtendibleProvisionAdjustedDates
    -- ^ The adjusted dates associated with an extendible
    --   provision. These dates have been adjusted for any
    --   applicable business day convention.
  callingParty : Optional CallingPartyEnum
  singlePartyOption : Optional PartyRole
    -- ^ If the ability to extend the contract is not
    --   available to both parties then this component
    --   specifies the buyer and seller of the option.
  noticeDeadlinePeriod : Optional RelativeDateOffset
    -- ^ Defines the minimum period before a contract is
    --   scheduled to terminate that notice can be given that
    --   it will terminate beyond the scheduled termination
    --   date.
  noticeDeadlineDateTime : Optional ZonedDateTime
    -- ^ A specific date and time for the notice deadline
  extensionTerm : Optional RelativeDateOffset
    -- ^ The length of each extension period relative to the
    --   effective date of the preceding contract.
  extensionPeriod : Optional AdjustableRelativeOrPeriodicDates
    -- ^ The period within which notice can be given that the
    --   contract will be extended.
  exerciseTerms : ExerciseTerms
    -- ^ The exercise terms associated with the extendible
    --   provision, including details such as exercise style,
    --   exercise fees, and any other relevant conditions or
    --   terms governing the extension of the swap
    --   transaction.
    deriving (Eq, Ord, Show)

-- | A data defining:  the adjusted dates associated with
--   a provision to extend a swap.
data ExtendibleProvisionAdjustedDates = ExtendibleProvisionAdjustedDates with 
  extensionEvent : [ExtensionEvent]
    -- ^ The adjusted dates associated with a single
    --   extendible exercise date.
    deriving (Eq, Ord, Show)

-- | A data to:  define the adjusted dates associated with
--   an individual extension event.
data ExtensionEvent = ExtensionEvent with 
  adjustedExerciseDate : Date
    -- ^ The date on which option exercise takes place. This
    --   date should already be adjusted for any applicable
    --   business day convention.
  adjustedExtendedTerminationDate : Date
    -- ^ The termination date if an extendible provision is
    --   exercised. This date should already be adjusted for
    --   any applicable business day convention.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | Where the underlying is shares, defines market events
--   affecting the issuer of those shares that may require
--   the terms of the transaction to be adjusted.
data ExtraordinaryEvents = ExtraordinaryEvents with 
  additionalBespokeTerms : [Clause]
    -- ^ Where parties may optionnaly describe any extra
    --   bespoke agreements, in regards of the standardized
    --   Extraordinary Events.
  mergerEvents : Optional EquityCorporateEvents
    -- ^ Per the 2018 ISDA CDM Equity Confirmation for
    --   Security Equity Swap
  tenderOfferEvents : Optional EquityCorporateEvents
    -- ^ Per the 2002 ISDA Equity Derivatives Definitions: 
  compositionOfCombinedConsideration : Optional Bool
    -- ^ Per the 2002 ISDA Equity Derivatives Definitions: 
  indexAdjustmentEvents : Optional IndexAdjustmentEvents
    -- ^ Per the 2002 ISDA Equity Derivatives Definitions:
    --   Adjustments to Indices 
  additionalDisruptionEvents : Optional AdditionalDisruptionEvents
    -- ^ Per the 2002 ISDA Equity Derivatives Definitions |
    --   2018 ISDA CDM Equity Confirmation for Security Equity
    --   Swaps
  failureToDeliver : Optional Bool
    -- ^ If true, failure to deliver is applicable.
  representations : Optional Representations
  nationalizationOrInsolvency : Optional NationalizationOrInsolvencyOrDelistingEventEnum
    -- ^ Per the 2002 ISDA Equity Derivatives Definitions |
    --   2018 ISDA CDM Equity Confirmation for Security Equity
    --   Swap
  delisting : Optional NationalizationOrInsolvencyOrDelistingEventEnum
    -- ^ Per the 2002 ISDA Equity Derivatives Definitions |
    --   2018 ISDA CDM Equity Confirmation for Security Equity
    --   Swap:
    deriving (Eq, Ord, Show)

data FailureToPay = FailureToPay with 
  applicable : Bool
    -- ^ Indicates whether the failure to pay provision is
    --   applicable.
  gracePeriodExtension : Optional GracePeriodExtension
    -- ^ If this element is specified, indicates whether or
    --   not a grace period extension is applicable. ISDA 2003
    --   Term: Grace Period Extension Applicable.
  paymentRequirement : Optional Money
    -- ^ Specifies a threshold for the failure to pay credit
    --   event. Market standard is USD 1,000,000 (JPY
    --   100,000,000 for Japanese Yen trades) or its
    --   equivalent in the relevant obligation currency. This
    --   is applied on an aggregate basis across all
    --   Obligations of the Reference Entity. Intended to
    --   prevent technical/operational errors from triggering
    --   credit events. ISDA 2003 Term: Payment Requirement
    deriving (Eq, Ord, Show)

-- | Defines the structure needed to represent fallback
--   rate parameters. This type is used to represent
--   modular computed rates in interestRatePayouts.
data FallbackRateParameters = FallbackRateParameters with 
  floatingRateIndex : FloatingRateIndexEnum
    -- ^ The floating rate index that is used as the basis of
    --   the fallback rate.
  effectiveDate : Optional Date
    -- ^ The date the fallback rate takes effect.
  calculationParameters : Optional FloatingRateCalculationParameters
    -- ^ Support for modular calculated rates, such such as
    --   lockout compound calculations.
  spreadAdjustment : Optional Decimal
    -- ^ The economic spread applied to the underlying
    --   fallback rate to replicate the original risky rate.
    deriving (Eq, Ord, Show)

-- | The method, prioritised by the order it is listed in
--   this element, to get a replacement rate for the
--   disrupted settlement rate option.
data FallbackReferencePrice = FallbackReferencePrice with 
  valuationPostponement : Optional ValuationPostponement
    -- ^ Specifies how long to wait to get a quote from a
    --   settlement rate option upon a price source
    --   disruption.
  fallBackSettlementRateOption : [FieldWithMeta SettlementRateOptionEnum]
    -- ^ This settlement rate option will be used in its
    --   place.
  fallbackSurveyValuationPostponement : Optional Bool
    -- ^ Request rate quotes from the market. This element is
    --   set as type Empty in FpML. When present, the FpML
    --   synonym is mapped to a value True in the CDM.
  calculationAgentDetermination : Optional CalculationAgent
    -- ^ The calculation agent will decide the rate.
    deriving (Eq, Ord, Show)

-- | Payment made following trigger occurrence.
data FeaturePayment = FeaturePayment with 
  payerReceiver : PartyReferencePayerReceiver
    -- ^ This attribute doesn't exist as part of the FpML
    --   construct, which makes use of the PayerReceiver.model
    --   group.
  levelPercentage : Optional Decimal
    -- ^ The trigger level percentage.
  amount : Optional Decimal
    -- ^ The monetary quantity in currency units.
  time : Optional TimeTypeEnum
    -- ^ The feature payment time.
  currency : Optional (FieldWithMeta Text)
    -- ^ The currency in which an amount is denominated.
  paymentDate : Optional AdjustableOrRelativeDate
    -- ^ The feature payment date.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

data FinInstrm = FinInstrm with 
  othr : Othr
    deriving (Eq, Ord, Show)

data FinInstrmGnlAttrbts = FinInstrmGnlAttrbts with 
  fullNm : Text
  clssfctnTp : Text
  ntnlCcy : Text
    deriving (Eq, Ord, Show)

data FinInstrmRptgTxRpt = FinInstrmRptgTxRpt with 
  tx : Tx
    deriving (Eq, Ord, Show)

-- | A data to:  define business date convention
--   adjustment to final payment period per leg.
data FinalCalculationPeriodDateAdjustment = FinalCalculationPeriodDateAdjustment with 
  relevantUnderlyingDateReference : (ReferenceWithMeta AdjustableOrRelativeDates)
    -- ^ Reference to the unadjusted cancellation effective
    --   dates.
  swapStreamReference : (ReferenceWithMeta InterestRatePayout)
    -- ^ Reference to the leg, where date adjustments may
    --   apply.
  businessDayConvention : BusinessDayConventionEnum
    -- ^ Override business date convention. This takes
    --   precedence over leg level information.
    deriving (Eq, Ord, Show)

-- | Type for reporting the detailed results of
--   calculating a cash flow for a calculation period. 
--   This is enhanced relative to the FpML-based cashflows
--   structure to allow more information to be returned
--   about daily compounded rates.
data FixedAmountCalculationDetails = FixedAmountCalculationDetails with 
  calculationPeriod : CalculationPeriodBase
    -- ^ The calculation period for which the floating
    --   calculation was performed.
  calculationPeriodNotionalAmount : Money
    -- ^ The notional in effect during the calculation period.
  fixedRate : Decimal
    -- ^ The value of the fixed rate that was used.
  yearFraction : Decimal
    -- ^ The fraction of a year that this calculation
    --   represents, according to the day count fraction
    --   method.
  calculatedAmount : Decimal
    -- ^ The amount of the cash flow that was computed,
    --   including any spreads and other processing.
    deriving (Eq, Ord, Show)

-- | A predefined price accorded by the counterparties.
data FixedPrice = FixedPrice with 
  price : Optional (ReferenceWithMeta PriceSchedule)
    -- ^ Fixed price step schedule, including an initial price
    --   specified as an absolute number.
    deriving (Eq, Ord, Show)

-- | Represents a fixed price payout. There is no
--   underlier associated with this payout type and is
--   based on fixed pricing per a given unit (e.g. in
--   commodities price per barrel)
data FixedPricePayout = FixedPricePayout with 
  payerReceiver : PayerReceiver
    -- ^ Canonical representation of the payer and receiver
    --   parties applicable to each payout leg.
  priceQuantity : Optional ResolvablePriceQuantity
    -- ^ Each payout leg must implement the quantity concept
    --   as a 'resolvable' type, which allows for
    --   different payout legs to be linked to each other
    --   (e.g. in the case of cross-curreny products).
  principalPayment : Optional PrincipalPayments
    -- ^ The specification of the principal exchange. Optional
    --   as only applicable in the case of cross-currency or
    --   zero-coupon swaps with a final payment.
  settlementTerms : Optional SettlementTerms
    -- ^ Each payout leg must specifies its settlement terms,
    --   including the delivery type (i.e. cash vs physical,
    --   and their respective terms), the transfer type (DvP
    --   etc.) and settlement date, if any.
  paymentDates : PaymentDates
    -- ^ Specifies the parameters to generate the payment date
    --   schedule, either through a parametric representation
    --   or by reference to specified dates.
  fixedPrice : FixedPrice
    -- ^ Specifies the fixed price on which fixed forward
    --   payments are based.
  schedule : Optional CalculationSchedule
    -- ^ Allows the full representation of a payout by
    --   defining a set of schedule periods. It supports
    --   standard schedule customization by expressing all the
    --   dates, quantities, and pricing data in a
    --   non-parametric way.
    deriving (Eq, Ord, Show)

-- | Type defining the specification for a fixed rate.
data FixedRateSpecification = FixedRateSpecification with 
  rateSchedule : Optional RateSchedule
    -- ^ The fixed rate or fixed rate schedule expressed as
    --   explicit fixed rates and dates. In the case of a
    --   schedule, the step dates may be subject to adjustment
    --   in accordance with any adjustments specified in
    --   calculationPeriodDatesAdjustments.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | Type for reporting the detailed results of
--   calculating a cash flow for a calculation period. 
--   This is enhanced relative to the FpML-based cashflows
--   structure to allow more information to be returned
--   about daily compounded rates.
data FloatingAmountCalculationDetails = FloatingAmountCalculationDetails with 
  calculationPeriod : CalculationPeriodBase
    -- ^ The calculation period for which the floating
    --   calculation was performed.
  calculationPeriodNotionalAmount : Money
    -- ^ The notional in effect during the calculation period.
  floatingRate : Optional FloatingRateSettingDetails
    -- ^ The details of the floating rate setting.  (If it is
    --   a calculated rate, details of that calculation will
    --   be inside that.
  processingDetails : Optional FloatingRateProcessingDetails
    -- ^ Details fo the floating rate treatment after the rate
    --   is observed or calculated.  This will include details
    --   of things like multipliers, spreads, caps and floors,
    --   and the raw and treated rates.
  appliedRate : Decimal
    -- ^ The rate that was actually applied, after all
    --   calculations and treatments.
  yearFraction : Decimal
    -- ^ The fraction of a year that this calculation
    --   represents, according to the day count fraction
    --   method.
  calculatedAmount : Decimal
    -- ^ The amount of the cash flow that was computed,
    --   including any spreads and other processing.
  spreadExclusiveCalculatedAMount : Decimal
    -- ^ The amount of the cash flow excluding any spread, for
    --   subsequent processing.
    deriving (Eq, Ord, Show)

-- | A class to specify the ISDA terms relating to the
--   floating rate payment events and the implied
--   additional fixed payments, applicable to the credit
--   derivatives transactions on mortgage-backed
--   securities with pay-as-you-go or physical settlement.
data FloatingAmountEvents = FloatingAmountEvents with 
  failureToPayPrincipal : Optional Bool
    -- ^ A floating rate payment event. Corresponds to the
    --   failure by the Reference Entity to pay an expected
    --   principal amount or the payment of an actual
    --   principal amount that is less than the expected
    --   principal amount. ISDA 2003 Term: Failure to Pay
    --   Principal.
  interestShortfall : Optional InterestShortFall
    -- ^ A floating rate payment event. With respect to any
    --   Reference Obligation Payment Date, either (a) the
    --   non-payment of an Expected Interest Amount or (b) the
    --   payment of an Actual Interest Amount that is less
    --   than the Expected Interest Amount. ISDA 2003 Term:
    --   Interest Shortfall.
  writedown : Optional Bool
    -- ^ A floating rate payment event. Results from the fact
    --   that the underlier writes down its outstanding
    --   principal amount. ISDA 2003 Term: Writedown.
  impliedWritedown : Optional Bool
    -- ^ A floating rate payment event. Results from the fact
    --   that losses occur to the underlying instruments that
    --   do not result in reductions of the outstanding
    --   principal of the reference obligation.
  floatingAmountProvisions : Optional FloatingAmountProvisions
    -- ^ Specifies the floating amount provisions associated
    --   with the floatingAmountEvents.
  additionalFixedPayments : Optional AdditionalFixedPayments
    -- ^ Specifies the events that will give rise to the
    --   payment additional fixed payments.
    deriving (Eq, Ord, Show)

data FloatingAmountProvisions = FloatingAmountProvisions with 
  wacCapInterestProvision : Optional Bool
    -- ^ As specified by the ISDA Supplement for use with
    --   trades on mortgage-backed securities, 'WAC
    --   Cap' means a weighted average coupon or weighted
    --   average rate cap provision (however defined in the
    --   Underlying Instruments) of the Underlying Instruments
    --   that limits, increases or decreases the interest rate
    --   or interest entitlement, as set out in the Underlying
    --   Instruments on the Effective Date without regard to
    --   any subsequent amendment The presence of the element
    --   with value set to 'true' signifies that the
    --   provision is applicable. From a usage standpoint,
    --   this provision is typically applicable in the case of
    --   CMBS and not applicable in case of RMBS trades.
  stepUpProvision : Optional Bool
    -- ^ As specified by the ISDA Standard Terms Supplement
    --   for use with trades on mortgage-backed securities.
    --   The presence of the element with value set to
    --   'true' signifies that the provision is
    --   applicable. If applicable, the applicable step-up
    --   terms are specified as part of that ISDA Standard
    --   Terms Supplement. From a usage standpoint, this
    --   provision is typically applicable in the case of RMBS
    --   and not applicable in case of CMBS trades.
    deriving (Eq, Ord, Show)

data FloatingRate = FloatingRate with 
  rateOption : Optional (ReferenceWithMeta FloatingRateIndex)
  spreadSchedule : Optional SpreadSchedule
    -- ^ The ISDA Spread or a Spread schedule expressed as
    --   explicit spreads and dates. In the case of a
    --   schedule, the step dates may be subject to adjustment
    --   in accordance with any adjustments specified in
    --   calculationPeriodDatesAdjustments. The spread is a
    --   per annum rate, expressed as a decimal. For purposes
    --   of determining a calculation period amount, if
    --   positive the spread will be added to the floating
    --   rate and if negative the spread will be subtracted
    --   from the floating rate. A positive 10 basis point
    --   (0.1%) spread would be represented as 0.001.
  capRateSchedule : Optional StrikeSchedule
    -- ^ The cap rate or cap rate schedule, if any, which
    --   applies to the floating rate. The cap rate (strike)
    --   is only required where the floating rate on a swap
    --   stream is capped at a certain level. A cap rate
    --   schedule is expressed as explicit cap rates and dates
    --   and the step dates may be subject to adjustment in
    --   accordance with any adjustments specified in
    --   calculationPeriodDatesAdjustments. The cap rate is
    --   assumed to be exclusive of any spread and is a per
    --   annum rate, expressed as a decimal. A cap rate of 5%
    --   would be represented as 0.05.
  floorRateSchedule : Optional StrikeSchedule
    -- ^ The floor rate or floor rate schedule, if any, which
    --   applies to the floating rate. The floor rate (strike)
    --   is only required where the floating rate on a swap
    --   stream is floored at a certain strike level. A floor
    --   rate schedule is expressed as explicit floor rates
    --   and dates and the step dates may be subject to
    --   adjustment in accordance with any adjustments
    --   specified in calculationPeriodDatesAdjustments. The
    --   floor rate is assumed to be exclusive of any spread
    --   and is a per annum rate, expressed as a decimal. A
    --   floor rate of 5% would be represented as 0.05.
  meta : Optional MetaFields
  floatingRateMultiplierSchedule : Optional RateSchedule
    -- ^ A rate multiplier or multiplier schedule to apply to
    --   the floating rate. A multiplier schedule is expressed
    --   as explicit multipliers and dates. In the case of a
    --   schedule, the step dates may be subject to adjustment
    --   in accordance with any adjustments specified in the
    --   calculationPeriodDatesAdjustments. The multiplier can
    --   be a positive or negative decimal. This element
    --   should only be included if the multiplier is not
    --   equal to 1 (one) for the term of the stream.
  rateTreatment : Optional RateTreatmentEnum
    -- ^ The specification of any rate conversion which needs
    --   to be applied to the observed rate before being used
    --   in any calculations. The two common conversions are
    --   for securities quoted on a bank discount basis which
    --   will need to be converted to either a Money Market
    --   Yield or Bond Equivalent Yield. See the Annex to the
    --   2000 ISDA Definitions, Section 7.3. Certain General
    --   Definitions Relating to Floating Rate Options,
    --   paragraphs (g) and (h) for definitions of these
    --   terms.
  calculationParameters : Optional FloatingRateCalculationParameters
    -- ^ Support for modular calculated rates, such such as
    --   lockout compound calculations.
  fallbackRate : Optional FallbackRateParameters
    -- ^ Definition of any fallback rate that may be
    --   applicable.
    deriving (Eq, Ord, Show)

-- | A class defining a floating interest rate through the
--   specification of the floating rate index, the tenor,
--   the multiplier schedule, the spread, the
--   qualification of whether a specific rate treatment
--   and/or a cap or floor apply.
data FloatingRateBase = FloatingRateBase with 
  rateOption : Optional (ReferenceWithMeta FloatingRateIndex)
  spreadSchedule : Optional SpreadSchedule
    -- ^ The ISDA Spread or a Spread schedule expressed as
    --   explicit spreads and dates. In the case of a
    --   schedule, the step dates may be subject to adjustment
    --   in accordance with any adjustments specified in
    --   calculationPeriodDatesAdjustments. The spread is a
    --   per annum rate, expressed as a decimal. For purposes
    --   of determining a calculation period amount, if
    --   positive the spread will be added to the floating
    --   rate and if negative the spread will be subtracted
    --   from the floating rate. A positive 10 basis point
    --   (0.1%) spread would be represented as 0.001.
  capRateSchedule : Optional StrikeSchedule
    -- ^ The cap rate or cap rate schedule, if any, which
    --   applies to the floating rate. The cap rate (strike)
    --   is only required where the floating rate on a swap
    --   stream is capped at a certain level. A cap rate
    --   schedule is expressed as explicit cap rates and dates
    --   and the step dates may be subject to adjustment in
    --   accordance with any adjustments specified in
    --   calculationPeriodDatesAdjustments. The cap rate is
    --   assumed to be exclusive of any spread and is a per
    --   annum rate, expressed as a decimal. A cap rate of 5%
    --   would be represented as 0.05.
  floorRateSchedule : Optional StrikeSchedule
    -- ^ The floor rate or floor rate schedule, if any, which
    --   applies to the floating rate. The floor rate (strike)
    --   is only required where the floating rate on a swap
    --   stream is floored at a certain strike level. A floor
    --   rate schedule is expressed as explicit floor rates
    --   and dates and the step dates may be subject to
    --   adjustment in accordance with any adjustments
    --   specified in calculationPeriodDatesAdjustments. The
    --   floor rate is assumed to be exclusive of any spread
    --   and is a per annum rate, expressed as a decimal. A
    --   floor rate of 5% would be represented as 0.05.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | Defines the structures needed to represent the
--   calculation parameters for daily averaged and
--   compounded modular rates as defined in the 2021 ISDA
--   Definitions in Section 7. This type is used to
--   represent modular computed rates in
--   interestRatePayouts.
data FloatingRateCalculationParameters = FloatingRateCalculationParameters with 
  calculationMethod : CalculationMethodEnum
    -- ^ calculation type (averaging or compounding).
  observationShiftCalculation : Optional ObservationShiftCalculation
    -- ^ any obervation shift parameters if applicable.
  lookbackCalculation : Optional OffsetCalculation
    -- ^ any lookback  parameters if applicable.
  lockoutCalculation : Optional OffsetCalculation
    -- ^ any lockout  parameters if applicable.
  applicableBusinessDays : Optional BusinessCenters
    -- ^ the business days that are applicable for the
    --   calculation.
  observationParameters : Optional ObservationParameters
    -- ^ any applicable observation parameters, such as daily
    --   caps or floors.
    deriving (Eq, Ord, Show)

-- | A data defining:  parameters associated with a
--   floating rate reset. This data forms:  part of the
--   cashflows representation of a stream.
data FloatingRateDefinition = FloatingRateDefinition with 
  calculatedRate : Optional Decimal
    -- ^ The final calculated rate for a calculation period
    --   after any required averaging of rates A calculated
    --   rate of 5% would be represented as 0.05.
  rateObservation : [RateObservation]
    -- ^ The details of a particular rate observation,
    --   including the fixing date and observed rate. A list
    --   of rate observation elements may be ordered in the
    --   document by ascending adjusted fixing date. An FpML
    --   document containing an unordered list of rate
    --   observations is still regarded as a conformant
    --   document.
  floatingRateMultiplier : Optional Decimal
    -- ^ A rate multiplier to apply to the floating rate. The
    --   multiplier can be a positive or negative decimal.
    --   This element should only be included if the
    --   multiplier is not equal to 1 (one).
  spread : Optional Decimal
    -- ^ The ISDA Spread, if any, which applies for the
    --   calculation period. The spread is a per annum rate,
    --   expressed as a decimal. For purposes of determining a
    --   calculation period amount, if positive the spread
    --   will be added to the floating rate and if negative
    --   the spread will be subtracted from the floating rate.
    --   A positive 10 basis point (0.1%) spread would be
    --   represented as 0.001.
  capRate : [Strike]
    -- ^ The cap rate, if any, which applies to the floating
    --   rate for the calculation period. The cap rate
    --   (strike) is only required where the floating rate on
    --   a swap stream is capped at a certain strike level.
    --   The cap rate is assumed to be exclusive of any spread
    --   and is a per annum rate, expressed as a decimal. A
    --   cap rate of 5% would be represented as 0.05.
  floorRate : [Strike]
    -- ^ The floor rate, if any, which applies to the floating
    --   rate for the calculation period. The floor rate
    --   (strike) is only required where the floating rate on
    --   a swap stream is floored at a certain strike level.
    --   The floor rate is assumed to be exclusive of any
    --   spread and is a per annum rate, expressed as a
    --   decimal. The floor rate of 5% would be represented as
    --   0.05.
    deriving (Eq, Ord, Show)

-- | An index based in interest rates or inflation rates
--   in a certain market.
data FloatingRateIndex = FloatingRateIndex with 
  interestRateIndex : Optional InterestRateIndex
    -- ^ An interest rate index which can change over time,
    --   e.g. the SONIA (Sterling Overnight Index Average) in
    --   the UK.
  inflationIndex : Optional InflationIndex
    -- ^ An index that measures inflation in a specific
    --   market, e.g. the US Consumer Price Index.
    deriving (Eq, Ord, Show)

-- | This holds the rate calculation defaults applicable
--   for a floating rate index.
data FloatingRateIndexCalculationDefaults = FloatingRateIndexCalculationDefaults with 
  category : Optional FloatingRateIndexCategoryEnum
    -- ^ The ISDA FRO category (e.g. screen rate or calculated
    --   rate).
  indexStyle : Optional FloatingRateIndexStyleEnum
    -- ^ The ISDA FRO style (e.g. term rate, swap rate, etc).
  method : Optional FloatingRateIndexCalculationMethodEnum
    -- ^ The ISDA FRO calculation method (e.g. OIS
    --   Compounding).
    deriving (Eq, Ord, Show)

data FloatingRateIndexDefinition = FloatingRateIndexDefinition with 
  fro : FloatingRateIndexIdentification
    -- ^ The underlying FRO name and designated maturity.
  calculationDefaults : Optional FloatingRateIndexCalculationDefaults
    -- ^ Any calculation default values.
    deriving (Eq, Ord, Show)

data FloatingRateIndexIdentification = FloatingRateIndexIdentification with 
  floatingRateIndex : Optional (FieldWithMeta FloatingRateIndexEnum)
    -- ^ The reference index that is used to specify the
    --   floating interest rate. The FpML standard maintains
    --   the list of such indices, which are positioned as
    --   enumeration values as part of the CDM.
  currency : Optional ISOCurrencyCodeEnum
    -- ^ FRO currency - 3 character ISO currrency code
  froType : Optional Text
    -- ^ FRO type (e.g. OIS)
    deriving (Eq, Ord, Show)

-- | Type for reporting the details of the rate treatment.
--   This could potentially be replaced by the existing
--   FloatingRateDefinition type , but this is slightly
--   more detailed.
data FloatingRateProcessingDetails = FloatingRateProcessingDetails with 
  rawRate : Decimal
    -- ^ The raw or untreated rate, prior to any of the rate
    --   treatments.
  processingParameters : Optional FloatingRateProcessingParameters
  processedRate : Decimal
    -- ^ The value of the rate after processing.
  spreadExclusiveRate : Decimal
    -- ^ The value of the processed rate without the spread
    --   applied, for subsequent compounding, etc.
    deriving (Eq, Ord, Show)

-- | Type to hold the processing parameters that should be
--   or were used to calculate a floating amount.  These
--   parameters can vary over a schedule so this type
--   holds the acutal values applicable to this
--   calculation.
data FloatingRateProcessingParameters = FloatingRateProcessingParameters with 
  initialRate : Optional Price
    -- ^ The rate to be applied for the initial period.
  multiplier : Optional Decimal
    -- ^ floating rate multiplier.
  spread : Optional Decimal
    -- ^ spread to be added to the floating rate.
  treatment : Optional RateTreatmentEnum
    -- ^ US rate treatment (Bond Equivalent Yield or Money
    --   Market Yield, if applicable.
  capRate : Optional Decimal
    -- ^ capt to be applied to the floating rate.
  floorRate : Optional Decimal
    -- ^ floor to be applied to the floating rate.
  rounding : Optional Rounding
    -- ^ THe final rate rounding to be applied.
  negativeTreatment : Optional NegativeInterestRateTreatmentEnum
    -- ^ How to handle negative interest rates.
    deriving (Eq, Ord, Show)

-- | Type for reporting the raw (untreated) observed or
--   calculated rate for a calculation period.  If this is
--   a calculated rate, it allows details of the
--   observations and the resulting rate to be returned.
data FloatingRateSettingDetails = FloatingRateSettingDetails with 
  calculationDetails : Optional CalculatedRateDetails
    -- ^ Calculated rate details (observation dates, values,
    --   and weights).
  observationDate : Optional Date
    -- ^ The day upon which the rate was observed (for term
    --   rates).
  resetDate : Optional Date
    -- ^ The day for which the rate is needed (e.g. period
    --   beginning or end date).
  floatingRate : Decimal
    -- ^ The resulting rate that was observed or calculated.
    deriving (Eq, Ord, Show)

-- | A class to specify the floating interest rate by
--   extending the floating rate definition with a set of
--   attributes that specify such rate: the initial value
--   specified as part of the trade, the rounding
--   convention, the averaging method and the negative
--   interest rate treatment.
data FloatingRateSpecification = FloatingRateSpecification with 
  rateOption : Optional (ReferenceWithMeta FloatingRateIndex)
  spreadSchedule : Optional SpreadSchedule
    -- ^ The ISDA Spread or a Spread schedule expressed as
    --   explicit spreads and dates. In the case of a
    --   schedule, the step dates may be subject to adjustment
    --   in accordance with any adjustments specified in
    --   calculationPeriodDatesAdjustments. The spread is a
    --   per annum rate, expressed as a decimal. For purposes
    --   of determining a calculation period amount, if
    --   positive the spread will be added to the floating
    --   rate and if negative the spread will be subtracted
    --   from the floating rate. A positive 10 basis point
    --   (0.1%) spread would be represented as 0.001.
  capRateSchedule : Optional StrikeSchedule
    -- ^ The cap rate or cap rate schedule, if any, which
    --   applies to the floating rate. The cap rate (strike)
    --   is only required where the floating rate on a swap
    --   stream is capped at a certain level. A cap rate
    --   schedule is expressed as explicit cap rates and dates
    --   and the step dates may be subject to adjustment in
    --   accordance with any adjustments specified in
    --   calculationPeriodDatesAdjustments. The cap rate is
    --   assumed to be exclusive of any spread and is a per
    --   annum rate, expressed as a decimal. A cap rate of 5%
    --   would be represented as 0.05.
  floorRateSchedule : Optional StrikeSchedule
    -- ^ The floor rate or floor rate schedule, if any, which
    --   applies to the floating rate. The floor rate (strike)
    --   is only required where the floating rate on a swap
    --   stream is floored at a certain strike level. A floor
    --   rate schedule is expressed as explicit floor rates
    --   and dates and the step dates may be subject to
    --   adjustment in accordance with any adjustments
    --   specified in calculationPeriodDatesAdjustments. The
    --   floor rate is assumed to be exclusive of any spread
    --   and is a per annum rate, expressed as a decimal. A
    --   floor rate of 5% would be represented as 0.05.
  meta : Optional MetaFields
  floatingRateMultiplierSchedule : Optional RateSchedule
    -- ^ A rate multiplier or multiplier schedule to apply to
    --   the floating rate. A multiplier schedule is expressed
    --   as explicit multipliers and dates. In the case of a
    --   schedule, the step dates may be subject to adjustment
    --   in accordance with any adjustments specified in the
    --   calculationPeriodDatesAdjustments. The multiplier can
    --   be a positive or negative decimal. This element
    --   should only be included if the multiplier is not
    --   equal to 1 (one) for the term of the stream.
  rateTreatment : Optional RateTreatmentEnum
    -- ^ The specification of any rate conversion which needs
    --   to be applied to the observed rate before being used
    --   in any calculations. The two common conversions are
    --   for securities quoted on a bank discount basis which
    --   will need to be converted to either a Money Market
    --   Yield or Bond Equivalent Yield. See the Annex to the
    --   2000 ISDA Definitions, Section 7.3. Certain General
    --   Definitions Relating to Floating Rate Options,
    --   paragraphs (g) and (h) for definitions of these
    --   terms.
  calculationParameters : Optional FloatingRateCalculationParameters
    -- ^ Support for modular calculated rates, such such as
    --   lockout compound calculations.
  fallbackRate : Optional FallbackRateParameters
    -- ^ Definition of any fallback rate that may be
    --   applicable.
  initialRate : Optional Price
    -- ^ The initial floating rate reset agreed between the
    --   principal parties involved in the trade. This is
    --   assumed to be the first required reset rate for the
    --   first regular calculation period. It should only be
    --   included when the rate is not equal to the rate
    --   published on the source implied by the floating rate
    --   index. An initial rate of 5% would be represented as
    --   0.05.
  finalRateRounding : Optional Rounding
    -- ^ The rounding convention to apply to the final rate
    --   used in determination of a calculation period amount.
  averagingMethod : Optional AveragingWeightingMethodEnum
    -- ^ If averaging is applicable, this component specifies
    --   whether a weighted or unweighted average method of
    --   calculation is to be used. The component must only be
    --   included when averaging applies.
  negativeInterestRateTreatment : Optional NegativeInterestRateTreatmentEnum
    -- ^ The specification of any provisions for calculating
    --   payment obligations when a floating rate is negative
    --   (either due to a quoted negative floating rate or by
    --   operation of a spread that is subtracted from the
    --   floating rate).
    deriving (Eq, Ord, Show)

-- | From FpML: A type defining either a spot or forward
--   FX transactions.
data ForeignExchange = ForeignExchange with 
  exchangedCurrency1 : Cashflow
    -- ^ This is the first of the two currency flows that
    --   define a single leg of a standard foreign exchange
    --   transaction.
  exchangedCurrency2 : Cashflow
    -- ^ This is the second of the two currency flows that
    --   define a single leg of a standard foreign exchange
    --   transaction.
  tenorPeriod : Optional Period
    -- ^ A tenor expressed as a period type and multiplier
    --   (e.g. 1D, 1Y, etc.)
    deriving (Eq, Ord, Show)

-- | Specification of a rate based on the exchange of a
--   pair of cash assets in specific currencies, e.g. USD
--   versus GBP.
data ForeignExchangeRateIndex = ForeignExchangeRateIndex with 
  identifier : [AssetIdentifier]
    -- ^ Asset Identifiers are used to uniquely identify an
    --   Asset, using a specified Asset Identifier Type.
  taxonomy : [Taxonomy]
    -- ^ Defines the taxonomy of an object by combining a
    --   taxonomy source (i.e. the rules to classify the
    --   object) and a value (i.e. the output of those rules
    --   on the object.
  isExchangeListed : Optional Bool
    -- ^ Defines whether the Asset is listed on a public
    --   exchange.
  exchange : Optional LegalEntity
    -- ^ If the Asset is listed, defines the public exchange
    --   of the listing.
  relatedExchange : [LegalEntity]
    -- ^ Provides the related Exchanges, if applicable.
  name : Optional (FieldWithMeta Text)
    -- ^ A description of the Index.
  provider : Optional LegalEntity
    -- ^ The organisation that creates or maintains the Index.
  assetClass : Optional AssetClassEnum
    -- ^ The Asset Class of the Index.
  quotedCurrencyPair : (FieldWithMeta QuotedCurrencyPair)
    -- ^ Describes the composition of a rate that has been
    --   quoted or is to be quoted.
  primaryFxSpotRateSource : InformationSource
    -- ^ Specifies the primary source from which a rate should
    --   be observed.
  secondaryFxSpotRateSource : Optional InformationSource
    -- ^ Specifies an alternative, or secondary, source from
    --   which a rate should be observed.
    deriving (Eq, Ord, Show)

-- | A class for defining a date frequency, e.g. one day,
--   three months, through the combination of an integer
--   value and a standardized period value that is
--   specified as part of an enumeration.
data Frequency = Frequency with 
  periodMultiplier : Int
    -- ^ A time period multiplier, e.g. 1, 2, or 3. If the
    --   period value is T (Term) then period multiplier must
    --   contain the value 1.
  period : PeriodExtendedEnum
    -- ^ A time period, e.g. a day, week, month, year or term
    --   of the stream.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A class defining a currency and a future value date.
data FutureValueAmount = FutureValueAmount with 
  quantity : Optional (ReferenceWithMeta NonNegativeQuantitySchedule)
  currency : (FieldWithMeta Text)
    -- ^ The currency in which the an amount is denominated.
    --   The list of valid currencies is not presently
    --   positioned as an enumeration as part of the CDM
    --   because that scope is limited to the values specified
    --   by ISDA and FpML. As a result, implementers have to
    --   make reference to the relevant standard, such as the
    --   ISO 4217 standard for currency codes.
  calculationPeriodNumberOfDays : Int
    -- ^ The number of days from the adjusted calculation
    --   period start date to the adjusted value date,
    --   calculated in accordance with the applicable day
    --   count fraction.
  valueDate : Date
    -- ^ Adjusted value date of the future value amount.
    deriving (Eq, Ord, Show)

-- | TransactionAdditionalTerms which apply to the
--   CurrencyPair asset class.
data FxAdditionalTerms = FxAdditionalTerms with 
    deriving (Eq, Ord, Show)

-- | A type for defining FX Features.
data FxFeature = FxFeature with 
  referenceCurrency : (FieldWithMeta Text)
    -- ^ Specifies the reference currency of the trade.
  composite : Optional Composite
    -- ^ If 'Composite' is specified as the Settlement
    --   Type in the relevant Transaction Supplement, an
    --   amount in the Settlement Currency, determined by the
    --   Calculation Agent as being equal to the number of
    --   Options exercised or deemed exercised, multiplied by:
    --   (Settlement Price – Strike Price) / (Strike Price –
    --   Settlement Price) x Multiplier provided that if the
    --   above is equal to a negative amount the Option Cash
    --   Settlement Amount shall be deemed to be zero.
  quanto : Optional Quanto
    -- ^ If 'Quanto' is specified as the Settlement
    --   Type in the relevant Transaction Supplement, an
    --   amount, as determined by the Calculation Agent in
    --   accordance with the Section 8.2 of the Equity
    --   Definitions.
  crossCurrency : Optional Composite
    -- ^ If 'Cross-Currency' is specified as the
    --   Settlement Type in the relevant Transaction
    --   Supplement, an amount in the Settlement Currency,
    --   determined by the Calculation Agent as being equal to
    --   the number of Options exercised or deemed exercised,
    --   multiplied by: (Settlement Price – Strike Price) /
    --   (Strike Price – Settlement Price) x Multiplier x one
    --   unit of the Reference Currency converted into an
    --   amount in the Settlement Currency using the rate of
    --   exchange of the Settlement Currency as quoted on the
    --   Reference Price Source on the Valuation Date,
    --   provided that if the above is equal to a negative
    --   amount the Option Cash Settlement Amount shall be
    --   deemed to be zero.
    deriving (Eq, Ord, Show)

-- | Extends the Offset structure to specify an FX fixing
--   date as an offset to dates specified somewhere else
--   in the document.
data FxFixingDate = FxFixingDate with 
  periodMultiplier : Int
    -- ^ A time period multiplier, e.g. 1, 2 or 3 etc. A
    --   negative value can be used when specifying an offset
    --   relative to another date, e.g. -2 days.
  period : PeriodEnum
    -- ^ A time period, e.g. a day, week, month or year of the
    --   stream. If the periodMultiplier value is 0 (zero)
    --   then period must contain the value D (day).
  meta : Optional MetaFields
  dayType : Optional DayTypeEnum
    -- ^ In the case of an offset specified as a number of
    --   days, this element defines whether consideration is
    --   given as to whether a day is a good business day or
    --   not. If a day type of business days is specified then
    --   non-business days are ignored when calculating the
    --   offset. The financial business centers to use for
    --   determination of business days are implied by the
    --   context in which this element is used. This element
    --   must only be included when the offset is specified as
    --   a number of days. If the offset is zero days then the
    --   dayType element should not be included.
  businessDayConvention : Optional BusinessDayConventionEnum
    -- ^ The convention for adjusting a date if it would
    --   otherwise fall on a day that is not a business day,
    --   as specified by an ISDA convention (e.g. Following,
    --   Precedent).
  businessCenters : Optional BusinessCenters
  businessCentersReference : Optional (ReferenceWithMeta BusinessCenters)
    -- ^ A reference to a set of financial business centers
    --   defined elsewhere in the document. This set of
    --   business centers is used to determine whether a
    --   particular day is a business day or not.
  dateRelativeToPaymentDates : Optional DateRelativeToPaymentDates
    -- ^ The payment date references on which settlements in
    --   non-deliverable currency are due and will then have
    --   to be converted according to the terms specified
    --   through the other parts of the
    --   nonDeliverableSettlement structure.
  dateRelativeToCalculationPeriodDates : Optional DateRelativeToCalculationPeriodDates
    -- ^ The calculation period references on which
    --   settlements in non-deliverable currency are due and
    --   will then have to be converted according to the terms
    --   specified through the other parts of the
    --   nonDeliverableSettlement structure. Implemented for
    --   Brazilian-CDI swaps where it will refer to the
    --   termination date of the appropriate leg.
  dateRelativeToValuationDates : Optional DateRelativeToValuationDates
    -- ^ The calculation period references on which
    --   settlements in non-deliverable currency are due and
    --   will then have to be converted according to the terms
    --   specified through the other parts of the
    --   nonDeliverableSettlement structure. Implemented for
    --   Brazilian-CDI swaps where it will refer to the
    --   termination date of the appropriate leg.
  fxFixingDate : Optional AdjustableOrRelativeDate
    -- ^ Describes the specific date when a non-deliverable
    --   forward or cash-settled option will 'fix'
    --   against a particular rate, which will be used to
    --   compute the ultimate cash settlement. This element
    --   should be omitted where a single, discrete fixing
    --   date cannot be identified e.g. on an american option,
    --   where fixing may occur at any date on a continuous
    --   range.  This attribute was formerly part of
    --   'fxSettlementTerms', which is now being
    --   harmonised into a common
    --   'CashSettlementTerms' that includes a
    --   'ValuationDate'.
    deriving (Eq, Ord, Show)

-- | Information source specific to Foreign Exchange
--   products.
data FxInformationSource = FxInformationSource with 
  sourceProvider : (FieldWithMeta InformationProviderEnum)
    -- ^ An information source for obtaining a market data
    --   point. For example Bloomberg, Reuters, Telerate, etc.
  sourcePage : Optional (FieldWithMeta Text)
    -- ^ A specific page for the source for obtaining a market
    --   data point. In FpML, this is specified as a scheme,
    --   rateSourcePageScheme, for which no coding Scheme or
    --   URI is specified.
  sourcePageHeading : Optional Text
    -- ^ The heading for the source on a given source page.
  fixingTime : Optional BusinessCenterTime
    -- ^ The time that the fixing will be taken along with a
    --   business center to define the time zone.
    deriving (Eq, Ord, Show)

-- | A data to:  describe the cashflow representation for
--   FX linked notionals.
data FxLinkedNotionalAmount = FxLinkedNotionalAmount with 
  resetDate : Optional Date
    -- ^ The reset date.
  adjustedFxSpotFixingDate : Optional Date
    -- ^ The date on which the FX spot rate is observed. This
    --   date should already be adjusted for any applicable
    --   business day convention.
  observedFxSpotRate : Optional Decimal
    -- ^ The actual observed FX spot rate.
  notionalAmount : Optional Decimal
    -- ^ The calculation period notional amount.
    deriving (Eq, Ord, Show)

-- | A data to:  describe a notional schedule where each
--   notional that applies to a calculation period is
--   calculated with reference to a notional amount or
--   notional amount schedule in a different currency by
--   means of a spot currency exchange rate which is
--   normally observed at the beginning of each period.
data FxLinkedNotionalSchedule = FxLinkedNotionalSchedule with 
  varyingNotionalCurrency : (FieldWithMeta Text)
    -- ^ The currency of the varying notional amount, i.e. the
    --   notional amount being determined periodically based
    --   on observation of a spot currency exchange rate. The
    --   list of valid currencies is not presently positioned
    --   as an enumeration as part of the CDM because that
    --   scope is limited to the values specified by ISDA and
    --   FpML. As a result, implementers have to make
    --   reference to the relevant standard, such as the ISO
    --   4217 standard for currency codes.
  varyingNotionalFixingDates : RelativeDateOffset
    -- ^ The dates on which spot currency exchange rates are
    --   observed for purposes of determining the varying
    --   notional currency amount that will apply to a
    --   calculation period.
  fxSpotRateSource : FxSpotRateSource
    -- ^ The information source and time at which the spot
    --   currency exchange rate will be observed.
  fixingTime : Optional BusinessCenterTime
    -- ^ The time at which the spot currency exchange rate
    --   will be observed. It is specified as a time in a
    --   business day calendar location, e.g. 11:00am London
    --   time.
  varyingNotionalInterimExchangePaymentDates : RelativeDateOffset
    -- ^ The dates on which interim exchanges of notional are
    --   paid. Interim exchanges will arise as a result of
    --   changes in the spot currency exchange amount or
    --   changes in the constant notional schedule (e.g.
    --   amortisation).
    deriving (Eq, Ord, Show)

-- | A class describing the rate of a currency conversion:
--   pair of currency, quotation mode and exchange rate.
data FxRate = FxRate with 
  quotedCurrencyPair : QuotedCurrencyPair
    -- ^ Defines the two currencies for an FX trade and the
    --   quotation relationship between the two currencies.
  rate : Optional Decimal
    -- ^ The rate of exchange between the two currencies of
    --   the leg of a deal. Must be specified with a quote
    --   basis.
    deriving (Eq, Ord, Show)

-- | Describes a rate source to be fixed and the date the
--   fixing occurs
data FxRateSourceFixing = FxRateSourceFixing with 
  settlementRateSource : FxSettlementRateSource
  fixingDate : AdjustableDate
    -- ^ The date on which the fixing is scheduled to occur.
    deriving (Eq, Ord, Show)

-- | The source of the Foreign Exchange settlement rate.
data FxSettlementRateSource = FxSettlementRateSource with 
  settlementRateOption : Optional (FieldWithMeta Text)
    -- ^ Indicates that an officially defined rate settlement
    --   rate option will be the used for the fixing.
  nonstandardSettlementRate : Optional FxInformationSource
    -- ^ Indicates that a non-standard rate source will be
    --   used for the fixing.
    deriving (Eq, Ord, Show)

-- | A class defining the rate source and fixing time for
--   an FX rate.
data FxSpotRateSource = FxSpotRateSource with 
  primarySource : InformationSource
    -- ^ The primary source for where the rate observation
    --   will occur. Will typically be either a page or a
    --   reference bank published rate.
  secondarySource : Optional InformationSource
    -- ^ An alternative, or secondary, source for where the
    --   rate observation will occur. Will typically be either
    --   a page or a reference bank published rate.
    deriving (Eq, Ord, Show)

-- | A class specifying a set of non-monetary terms for
--   the Credit Derivative Transaction, including the
--   buyer and seller and selected items from the ISDA
--   2014 Credit Definition article II, such as the
--   reference obligation and related terms. The CDM
--   GeneralTerms class corresponds to the FpML
--   GeneralTerms complex type, except that the
--   effectiveDate and scheduledTerminationDate have been
--   positioned as part of the InterestRatePayout class in
--   the CDM instead of in GeneralTerms.
data GeneralTerms = GeneralTerms with 
  referenceInformation : Optional ReferenceInformation
    -- ^ This attribute contains all the terms relevant to
    --   defining the reference entity and reference
    --   obligation(s).
  indexReferenceInformation : Optional CreditIndex
    -- ^ This attribute contains all the terms relevant to the
    --   underlying Index.
  basketReferenceInformation : Optional BasketReferenceInformation
    -- ^ This attribute contains all the terms relevant to
    --   defining the Credit Default Swap Basket.
  additionalTerm : [FieldWithMeta Text]
    -- ^ This attribute is used for representing information
    --   contained in the Additional Terms field of the 2003
    --   Master Credit Derivatives confirm.
  substitution : Optional Bool
    -- ^ Value of this attribute set to 'true'
    --   indicates that substitution is applicable.
  modifiedEquityDelivery : Optional Bool
    -- ^ Value of this attribute set to 'true'
    --   indicates that modified equity delivery is
    --   applicable.
    deriving (Eq, Ord, Show)

data GracePeriodExtension = GracePeriodExtension with 
  applicable : Bool
    -- ^ Indicates whether the grace period extension
    --   provision is applicable.
  gracePeriod : Optional Offset
    -- ^ The number of calendar or business days after any due
    --   date that the reference entity has to fulfil its
    --   obligations before a failure to pay credit event is
    --   deemed to have occurred. ISDA 2003 Term: Grace
    --   Period.
    deriving (Eq, Ord, Show)

data Id = Id with 
  lei : Text
    deriving (Eq, Ord, Show)

-- | Attaches an identifier to a collection of objects,
--   when those objects themselves can each be represented
--   by an identifier. One use case is the representation
--   of package transactions, where each component is a
--   separate trade with its own identifier, and those
--   trades are linked together as a package with its own
--   identifier. The data type has been named generically
--   rather than referring to 'packages' as it may
--   have a number of other uses.
data IdentifiedList = IdentifiedList with 
  listId : Identifier
    -- ^ The identifier for the list. In the case of a package
    --   transaction, this would be the package identifier.
    --   This attribute is mandatory to allow the list itself
    --   to be identified.
  componentId : [Identifier]
    -- ^ Identifiers for each component of the list. Since the
    --   data type is used to link multiple identified objects
    --   together, at least 2 components are required in the
    --   list. Creating an identified list with only 1
    --   identified component has been deemed unnecessary,
    --   because it would just create a redundant identifier.
  price : Optional Price
    -- ^ The price of the package.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A class to specify a generic identifier, applicable
--   to CDM artefacts such as executions, contracts,
--   lifecycle events and legal documents. An issuer can
--   be associated with the actual identifier value as a
--   way to properly qualify it.
data Identifier = Identifier with 
  issuerReference : Optional (ReferenceWithMeta Party)
    -- ^ The identifier issuer, when specified by reference to
    --   a party specified as part of the transaction.
  issuer : Optional (FieldWithMeta Text)
    -- ^ The identifier issuer, when specified explicitly
    --   alongside the identifier value (instead of being
    --   specified by reference to a party).
  assignedIdentifier : [AssignedIdentifier]
    -- ^ The identifier value. This level of indirection
    --   between the issuer and the identifier and its version
    --   provides the ability to associate multiple
    --   identifiers to one issuer, consistently with the FpML
    --   PartyTradeIdentifier.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A class specifying the Independent Amount as the
--   combination of a payer/receiver, a payment amount, a
--   payment date and an associated payment calculation
--   rule.
data IndependentAmount = IndependentAmount with 
  payerPartyReference : (ReferenceWithMeta Party)
    -- ^ The party responsible for making the payments defined
    --   by this structure.
  payerAccountReference : Optional (ReferenceWithMeta Account)
    -- ^ A reference to the account responsible for making the
    --   payments defined by this structure.
  receiverPartyReference : (ReferenceWithMeta Party)
    -- ^ The party that receives the payments corresponding to
    --   this structure.
  receiverAccountReference : Optional (ReferenceWithMeta Account)
    -- ^ A reference to the account that receives the payments
    --   corresponding to this structure.
  paymentDetail : [PaymentDetail]
    -- ^ An attribute that specifies a payment as the
    --   combination of a payment amount, a payment date and
    --   an associated payment calculation rule.
    deriving (Eq, Ord, Show)

-- | An Index is an Observable which is computed based on
--   the prices, rates or valuations of a number of assets
--   that are tracked in a standardized way.  Examples
--   include equity market indices as well as indices on
--   interest rates, inflation and credit instruments.
data Index = Index with 
  creditIndex : Optional CreditIndex
    -- ^ An index based on credit risk, typically composed
    --   using corporate debt instruments in a region or
    --   industry sector, e.g. the iTraxx indices.
  equityIndex : Optional EquityIndex
    -- ^ An index based on equity securities, e.g. the S&P
    --   500.
  floatingRateIndex : Optional (FieldWithMeta FloatingRateIndex)
    -- ^ An index based in interest rates or inflation rates
    --   in a certain market.
  foreignExchangeRateIndex : Optional ForeignExchangeRateIndex
    -- ^ A rate based on the exchange of a pair of cash assets
    --   in specific currencies, e.g. USD versus GBP.
  otherIndex : Optional OtherIndex
    -- ^ An index created by a market participant which
    --   doesn't align with the other index types.
    deriving (Eq, Ord, Show)

-- | Defines the specification of the consequences of
--   Index Events as defined by the 2002 ISDA Equity
--   Derivatives Definitions.
data IndexAdjustmentEvents = IndexAdjustmentEvents with 
    deriving (Eq, Ord, Show)

-- | Identifies an index by referencing an identifier.
data IndexBase = IndexBase with 
  identifier : [AssetIdentifier]
    -- ^ Asset Identifiers are used to uniquely identify an
    --   Asset, using a specified Asset Identifier Type.
  taxonomy : [Taxonomy]
    -- ^ Defines the taxonomy of an object by combining a
    --   taxonomy source (i.e. the rules to classify the
    --   object) and a value (i.e. the output of those rules
    --   on the object.
  isExchangeListed : Optional Bool
    -- ^ Defines whether the Asset is listed on a public
    --   exchange.
  exchange : Optional LegalEntity
    -- ^ If the Asset is listed, defines the public exchange
    --   of the listing.
  relatedExchange : [LegalEntity]
    -- ^ Provides the related Exchanges, if applicable.
  name : Optional (FieldWithMeta Text)
    -- ^ A description of the Index.
  provider : Optional LegalEntity
    -- ^ The organisation that creates or maintains the Index.
  assetClass : Optional AssetClassEnum
    -- ^ The Asset Class of the Index.
    deriving (Eq, Ord, Show)

-- | Defines the information needed to create a Index
--   Transition Business Event.
data IndexTransitionInstruction = IndexTransitionInstruction with 
  priceQuantity : [PriceQuantity]
    -- ^ Specifies both new floating rate index and spread
    --   adjustment for each leg to be updated.  The spread
    --   adjustment accounts for the difference between the
    --   old floating rate index relative to the new one. This
    --   spread amount is added to the existing spread to
    --   determine the new spread, which is applied from the
    --   specified effective date forward. In the case of the
    --   IBOR Fallback Rate Adjustments, the adjustment spread
    --   (also known as the Fallback Adjustment) accounts for
    --   two distinctions: i) the fact that the replacement
    --   Risk-Free Rate is an overnight rate while IBORs have
    --   term structures (e.g., 1, 3, 6-month LIBOR); and (ii)
    --   the historical spread differential between IBORs and
    --   their term equivalent Overnight Risk-Free Rate
    --   compounded rates.
  effectiveDate : Date
    -- ^ Specifies the effective date of the index transition
    --   event. This is first date on which the floating rate
    --   calculation will use the new floating rate index and
    --   adjusted spread in the floating rate calculation.
  cashTransfer : Optional Transfer
    -- ^ Specifies the cash transfer that can optionally be
    --   tied to an index transition event.
    deriving (Eq, Ord, Show)

data Indx = Indx with 
  nm : Nm
    deriving (Eq, Ord, Show)

-- | Specification of an index that measures inflation in
--   a specific market, e.g. the US Consumer Price Index.
data InflationIndex = InflationIndex with 
  identifier : [AssetIdentifier]
    -- ^ Asset Identifiers are used to uniquely identify an
    --   Asset, using a specified Asset Identifier Type.
  taxonomy : [Taxonomy]
    -- ^ Defines the taxonomy of an object by combining a
    --   taxonomy source (i.e. the rules to classify the
    --   object) and a value (i.e. the output of those rules
    --   on the object.
  isExchangeListed : Optional Bool
    -- ^ Defines whether the Asset is listed on a public
    --   exchange.
  exchange : Optional LegalEntity
    -- ^ If the Asset is listed, defines the public exchange
    --   of the listing.
  relatedExchange : [LegalEntity]
    -- ^ Provides the related Exchanges, if applicable.
  name : Optional (FieldWithMeta Text)
    -- ^ A description of the Index.
  provider : Optional LegalEntity
    -- ^ The organisation that creates or maintains the Index.
  assetClass : Optional AssetClassEnum
    -- ^ The Asset Class of the Index.
  inflationRateIndex : (FieldWithMeta InflationRateIndexEnum)
    -- ^ The reference index that is used to specify the
    --   inflation interest rate.
  indexTenor : Optional Period
    -- ^ The ISDA Designated Maturity, i.e. the floating rate
    --   tenor.
    deriving (Eq, Ord, Show)

-- | A data to:  specify the inflation rate.
data InflationRateSpecification = InflationRateSpecification with 
  rateOption : Optional (ReferenceWithMeta FloatingRateIndex)
  spreadSchedule : Optional SpreadSchedule
    -- ^ The ISDA Spread or a Spread schedule expressed as
    --   explicit spreads and dates. In the case of a
    --   schedule, the step dates may be subject to adjustment
    --   in accordance with any adjustments specified in
    --   calculationPeriodDatesAdjustments. The spread is a
    --   per annum rate, expressed as a decimal. For purposes
    --   of determining a calculation period amount, if
    --   positive the spread will be added to the floating
    --   rate and if negative the spread will be subtracted
    --   from the floating rate. A positive 10 basis point
    --   (0.1%) spread would be represented as 0.001.
  capRateSchedule : Optional StrikeSchedule
    -- ^ The cap rate or cap rate schedule, if any, which
    --   applies to the floating rate. The cap rate (strike)
    --   is only required where the floating rate on a swap
    --   stream is capped at a certain level. A cap rate
    --   schedule is expressed as explicit cap rates and dates
    --   and the step dates may be subject to adjustment in
    --   accordance with any adjustments specified in
    --   calculationPeriodDatesAdjustments. The cap rate is
    --   assumed to be exclusive of any spread and is a per
    --   annum rate, expressed as a decimal. A cap rate of 5%
    --   would be represented as 0.05.
  floorRateSchedule : Optional StrikeSchedule
    -- ^ The floor rate or floor rate schedule, if any, which
    --   applies to the floating rate. The floor rate (strike)
    --   is only required where the floating rate on a swap
    --   stream is floored at a certain strike level. A floor
    --   rate schedule is expressed as explicit floor rates
    --   and dates and the step dates may be subject to
    --   adjustment in accordance with any adjustments
    --   specified in calculationPeriodDatesAdjustments. The
    --   floor rate is assumed to be exclusive of any spread
    --   and is a per annum rate, expressed as a decimal. A
    --   floor rate of 5% would be represented as 0.05.
  meta : Optional MetaFields
  floatingRateMultiplierSchedule : Optional RateSchedule
    -- ^ A rate multiplier or multiplier schedule to apply to
    --   the floating rate. A multiplier schedule is expressed
    --   as explicit multipliers and dates. In the case of a
    --   schedule, the step dates may be subject to adjustment
    --   in accordance with any adjustments specified in the
    --   calculationPeriodDatesAdjustments. The multiplier can
    --   be a positive or negative decimal. This element
    --   should only be included if the multiplier is not
    --   equal to 1 (one) for the term of the stream.
  rateTreatment : Optional RateTreatmentEnum
    -- ^ The specification of any rate conversion which needs
    --   to be applied to the observed rate before being used
    --   in any calculations. The two common conversions are
    --   for securities quoted on a bank discount basis which
    --   will need to be converted to either a Money Market
    --   Yield or Bond Equivalent Yield. See the Annex to the
    --   2000 ISDA Definitions, Section 7.3. Certain General
    --   Definitions Relating to Floating Rate Options,
    --   paragraphs (g) and (h) for definitions of these
    --   terms.
  calculationParameters : Optional FloatingRateCalculationParameters
    -- ^ Support for modular calculated rates, such such as
    --   lockout compound calculations.
  fallbackRate : Optional FallbackRateParameters
    -- ^ Definition of any fallback rate that may be
    --   applicable.
  initialRate : Optional Price
    -- ^ The initial floating rate reset agreed between the
    --   principal parties involved in the trade. This is
    --   assumed to be the first required reset rate for the
    --   first regular calculation period. It should only be
    --   included when the rate is not equal to the rate
    --   published on the source implied by the floating rate
    --   index. An initial rate of 5% would be represented as
    --   0.05.
  finalRateRounding : Optional Rounding
    -- ^ The rounding convention to apply to the final rate
    --   used in determination of a calculation period amount.
  averagingMethod : Optional AveragingWeightingMethodEnum
    -- ^ If averaging is applicable, this component specifies
    --   whether a weighted or unweighted average method of
    --   calculation is to be used. The component must only be
    --   included when averaging applies.
  negativeInterestRateTreatment : Optional NegativeInterestRateTreatmentEnum
    -- ^ The specification of any provisions for calculating
    --   payment obligations when a floating rate is negative
    --   (either due to a quoted negative floating rate or by
    --   operation of a spread that is subtracted from the
    --   floating rate).
  inflationLag : Offset
    -- ^ An off-setting period from the payment date which
    --   determines the reference period for which the
    --   inflation index is observed.
  indexSource : (FieldWithMeta Text)
    -- ^ The reference source such as Reuters or Bloomberg.
    --   FpML specifies indexSource to be of type
    --   rateSourcePageScheme, but without specifying actual
    --   values.
  mainPublication : (FieldWithMeta Text)
    -- ^ The current main publication source such as relevant
    --   web site or a government body. FpML specifies
    --   mainPublication to be of type mainPublicationSource,
    --   but without specifying actual values.
  interpolationMethod : (FieldWithMeta InterpolationMethodEnum)
    -- ^ The method used when calculating the Inflation Index
    --   Level from multiple points. The most common is
    --   Linear.
  initialIndexLevel : Optional Decimal
    -- ^ Initial known index level for the first calculation
    --   period.
  fallbackBondApplicable : Bool
    -- ^ The applicability of a fallback bond as defined in
    --   the 2006 ISDA Inflation Derivatives Definitions,
    --   sections 1.3 and 1.8.
  calculationMethod : Optional InflationCalculationMethodEnum
    -- ^ Indicates how to use the inflation index to calculate
    --   the payment (e.g. Ratio, Return, Spread). Added for
    --   Inflation Asset Swap
  calculationStyle : Optional InflationCalculationStyleEnum
    -- ^ Indicates the style of how the inflation index
    --   calculates the payment (e.g. YearOnYear, ZeroCoupon).
  finalPrincipalExchangeCalculation : Optional FinalPrincipalExchangeCalculationEnum
    -- ^ To be specified only for products that embed a
    --   redemption payment.
    deriving (Eq, Ord, Show)

-- | A class defining the source for a piece of
--   information (e.g. a rate fix or an FX fixing). The
--   attribute names have been adjusted from FpML to
--   address the fact that the information is not limited
--   to rates.
data InformationSource = InformationSource with 
  sourceProvider : (FieldWithMeta InformationProviderEnum)
    -- ^ An information source for obtaining a market data
    --   point. For example Bloomberg, Reuters, Telerate, etc.
  sourcePage : Optional (FieldWithMeta Text)
    -- ^ A specific page for the source for obtaining a market
    --   data point. In FpML, this is specified as a scheme,
    --   rateSourcePageScheme, for which no coding Scheme or
    --   URI is specified.
  sourcePageHeading : Optional Text
    -- ^ The heading for the source on a given source page.
    deriving (Eq, Ord, Show)

-- | A CDM class which purpose is to specify the initial
--   fixing date either alongside the FpML interest rate
--   specification as an offset of another date, or
--   alongside the credit derivative specification as an
--   unadjusted date.
data InitialFixingDate = InitialFixingDate with 
  relativeDateOffset : Optional RelativeDateOffset
  initialFixingDate : Optional Date
    deriving (Eq, Ord, Show)

-- | Instruction to a function that will be used to
--   perform a business event
data Instruction = Instruction with 
  primitiveInstruction : Optional PrimitiveInstruction
    -- ^ Specifies the primitive instructions that will be
    --   used to call primitive event functions.
  before : Optional (ReferenceWithMeta TradeState)
    -- ^ Specifies the trade state that will be acted on by
    --   the primitive event functions.
    deriving (Eq, Ord, Show)

-- | A type of Asset that is issued by one party to one or
--   more others.
data Instrument = Instrument with 
  listedDerivative : Optional ListedDerivative
    -- ^ A securitized derivative on another asset that is
    --   created by an exchange.
  loan : Optional Loan
    -- ^ An Asset that represents a loan or borrow obligation.
  security : Optional Security
    -- ^ An Asset that is issued by a party to be held by or
    --   transferred to others.
    deriving (Eq, Ord, Show)

-- | Defines the common attributes for all Instrument data
--   types.
data InstrumentBase = InstrumentBase with 
  identifier : [AssetIdentifier]
    -- ^ Asset Identifiers are used to uniquely identify an
    --   Asset, using a specified Asset Identifier Type.
  taxonomy : [Taxonomy]
    -- ^ Defines the taxonomy of an object by combining a
    --   taxonomy source (i.e. the rules to classify the
    --   object) and a value (i.e. the output of those rules
    --   on the object.
  isExchangeListed : Optional Bool
    -- ^ Defines whether the Asset is listed on a public
    --   exchange.
  exchange : Optional LegalEntity
    -- ^ If the Asset is listed, defines the public exchange
    --   of the listing.
  relatedExchange : [LegalEntity]
    -- ^ Provides the related Exchanges, if applicable.
  instrumentType : InstrumentTypeEnum
    -- ^ Identifies the type of an instrument using an
    --   enumerated list.
    deriving (Eq, Ord, Show)

-- | A class to specify the application of Interest Amount
--   with respect to the Delivery Amount and the Return
--   Amount.
data InterestAmountApplication = InterestAmountApplication with 
  returnAmount : ReturnAmount
    -- ^ The application of Interest Amount with respect the
    --   Return Amount.
  deliveryAmount : DeliveryAmount
    -- ^ The application of Interest Amount with respect the
    --   Delivery Amount.
    deriving (Eq, Ord, Show)

data InterestRateCurve = InterestRateCurve with 
  floatingRateIndex : (FieldWithMeta FloatingRateIndexEnum)
  tenor : Period
    deriving (Eq, Ord, Show)

-- | Specification of an interest rate index which can
--   change over time, e.g. the SONIA (Sterling Overnight
--   Index Average) in the UK.
data InterestRateIndex = InterestRateIndex with 
  identifier : [AssetIdentifier]
    -- ^ Asset Identifiers are used to uniquely identify an
    --   Asset, using a specified Asset Identifier Type.
  taxonomy : [Taxonomy]
    -- ^ Defines the taxonomy of an object by combining a
    --   taxonomy source (i.e. the rules to classify the
    --   object) and a value (i.e. the output of those rules
    --   on the object.
  isExchangeListed : Optional Bool
    -- ^ Defines whether the Asset is listed on a public
    --   exchange.
  exchange : Optional LegalEntity
    -- ^ If the Asset is listed, defines the public exchange
    --   of the listing.
  relatedExchange : [LegalEntity]
    -- ^ Provides the related Exchanges, if applicable.
  name : Optional (FieldWithMeta Text)
    -- ^ A description of the Index.
  provider : Optional LegalEntity
    -- ^ The organisation that creates or maintains the Index.
  assetClass : Optional AssetClassEnum
    -- ^ The Asset Class of the Index.
  floatingRateIndex : (FieldWithMeta FloatingRateIndexEnum)
    -- ^ The reference index that is used to specify the
    --   floating interest rate.
  indexTenor : Optional Period
    -- ^ The ISDA Designated Maturity, i.e. the floating rate
    --   tenor.
    deriving (Eq, Ord, Show)

-- | A class to specify all of the terms necessary to
--   define and calculate a cash flow based on a fixed, a
--   floating or an inflation index rate. The interest
--   rate payout can be applied to interest rate swaps and
--   FRA (which both have two associated interest rate
--   payouts), credit default swaps (to represent the fee
--   leg when subject to periodic payments) and equity
--   swaps (to represent the funding leg). The associated
--   globalKey denotes the ability to associate a hash
--   value to the InterestRatePayout instantiations for
--   the purpose of model cross-referencing, in support of
--   functionality such as the event effect and the
--   lineage.
data InterestRatePayout = InterestRatePayout with 
  payerReceiver : PayerReceiver
    -- ^ Canonical representation of the payer and receiver
    --   parties applicable to each payout leg.
  priceQuantity : Optional ResolvablePriceQuantity
    -- ^ Each payout leg must implement the quantity concept
    --   as a 'resolvable' type, which allows for
    --   different payout legs to be linked to each other
    --   (e.g. in the case of cross-curreny products).
  principalPayment : Optional PrincipalPayments
    -- ^ The specification of the principal exchange. Optional
    --   as only applicable in the case of cross-currency or
    --   zero-coupon swaps with a final payment.
  settlementTerms : Optional SettlementTerms
    -- ^ Each payout leg must specifies its settlement terms,
    --   including the delivery type (i.e. cash vs physical,
    --   and their respective terms), the transfer type (DvP
    --   etc.) and settlement date, if any.
  rateSpecification : Optional RateSpecification
    -- ^ The specification of the rate value(s) applicable to
    --   the contract using either a floating rate
    --   calculation, a single fixed rate, a fixed rate
    --   schedule, or an inflation rate calculation.
  dayCountFraction : Optional (FieldWithMeta DayCountFractionEnum)
    -- ^ The day count fraction. The cardinality has been
    --   relaxed when compared with the FpML interest rate
    --   swap for the purpose of accommodating standardized
    --   credit default swaps which DCF is not explicitly
    --   stated as part of the economic terms. The data rule
    --   InterestRatePayout_dayCountFraction requires that the
    --   DCF be stated for interest rate products.
  calculationPeriodDates : Optional CalculationPeriodDates
    -- ^ The parameters used to generate the calculation
    --   period dates schedule, including the specification of
    --   any initial or final stub calculation periods.
  paymentDates : Optional PaymentDates
    -- ^ The payment date schedule, as defined by the
    --   parameters that are needed to specify it, either in a
    --   parametric way or by reference to another schedule of
    --   dates (e.g. the reset dates).
  paymentDate : Optional AdjustableDate
    -- ^ The payment date, where only one date is specified,
    --   as for the FRA product.
  paymentDelay : Optional Bool
    -- ^ Applicable to CDS on MBS to specify whether payment
    --   delays are applicable to the fixed Amount. RMBS
    --   typically have a payment delay of 5 days between the
    --   coupon date of the reference obligation and the
    --   payment date of the synthetic swap. CMBS do not, on
    --   the other hand, with both payment dates being on the
    --   25th of each month.
  resetDates : Optional ResetDates
    -- ^ The reset dates schedule, i.e. the dates on which the
    --   new observed index value is applied for each period
    --   and the interest rate hence begins to accrue.
  discountingMethod : Optional DiscountingMethod
    -- ^ The parameters specifying any discounting conventions
    --   that may apply. This element must only be included if
    --   discounting applies.
  compoundingMethod : Optional CompoundingMethodEnum
    -- ^ If one or more calculation period contributes to a
    --   single payment amount this element specifies whether
    --   compounding is applicable and, if so, what
    --   compounding method is to be used. This element must
    --   only be included when more than one calculation
    --   period contributes to a single payment amount.
  cashflowRepresentation : Optional CashflowRepresentation
    -- ^ The cashflow representation of the swap stream.
  stubPeriod : Optional StubPeriod
    -- ^ The stub calculation period amount parameters. This
    --   element must only be included if there is an initial
    --   or final stub calculation period. Even then, it must
    --   only be included if either the stub references a
    --   different floating rate tenor to the regular
    --   calculation periods, or if the stub is calculated as
    --   a linear interpolation of two different floating rate
    --   tenors, or if a specific stub rate or stub amount has
    --   been negotiated.
  bondReference : Optional BondReference
    -- ^ Reference to a bond underlier to represent an asset
    --   swap or Condition Precedent Bond.
  fixedAmount : Optional Text
    -- ^ Fixed Amount Calculation
  floatingAmount : Optional Text
    -- ^ Floating Amount Calculation
  spreadCalculationMethod : Optional SpreadCalculationMethodEnum
    -- ^ Method by which spread is calculated. For example on
    --   an asset swap: 'ParPar' or 'Proceeds'
    --   may be the method indicated.
    deriving (Eq, Ord, Show)

-- | A class to specify the interest shortfall floating
--   rate payment event.
data InterestShortFall = InterestShortFall with 
  interestShortfallCap : InterestShortfallCapEnum
    -- ^ Specifies the nature of the interest Shortfall cap
    --   (i.e. Fixed Cap or Variable Cap) in the case where it
    --   is applicable. ISDA 2003 Term: Interest Shortfall
    --   Cap.
  compounding : Bool
  rateSource : Optional (FieldWithMeta FloatingRateIndexEnum)
    -- ^ The rate source in the case of a variable cap.
    deriving (Eq, Ord, Show)

-- | A data type that can be used to describe an inventory
--   of securities.
data Inventory = Inventory with 
  inventoryRecord : [InventoryRecord]
    -- ^ An array holding the list of inventory being
    --   described. Each element in the inventoryRecord array
    --   represents an individual piece of inventory i.e. a
    --   security.
    deriving (Eq, Ord, Show)

-- | An individual piece of inventory. This represents a
--   single security.
data InventoryRecord = InventoryRecord with 
  identifer : AssignedIdentifier
    -- ^ Unique identifier for this record. This can be used
    --   to uniquely identify a specific piece of inventory.
  security : Security
    -- ^ The security details.
    deriving (Eq, Ord, Show)

data InvstmtDcsnPrsn = InvstmtDcsnPrsn with 
  prsn : Prsn
    deriving (Eq, Ord, Show)

-- | Represents a criteria used to specify eligible
--   collateral issuers.
data IssuerCriteria = IssuerCriteria with 
  issuerType : [CollateralIssuerType]
    -- ^ Represents a filter based on the type of entity
    --   issuing the asset.
  issuerCountryOfOrigin : [ISOCountryCodeEnum]
    -- ^ Represents a filter on the issuing entity country of
    --   origin based on the ISO Standard 3166, which is the
    --   same as filtering by eligible Sovereigns.
  issuerName : [LegalEntity]
    -- ^ Specifies the issuing entity name or LEI.
  issuerAgencyRating : [AgencyRatingCriteria]
    -- ^ Represents an agency rating based on default risk and
    --   creditors claim in event of default associated with
    --   asset issuer.
  sovereignAgencyRating : [AgencyRatingCriteria]
    -- ^ Represents an agency rating based on default risk of
    --   the country of the issuer.
  counterpartyOwnIssuePermitted : Optional Bool
    -- ^ Represents a filter based on whether it is permitted
    --   for the underlying asset to be issued by the posting
    --   entity or part of their corporate family.
    deriving (Eq, Ord, Show)

-- | Knock In means option to exercise comes into
--   existence. Knock Out means option to exercise goes
--   out of existence.
data Knock = Knock with 
  knockIn : Optional TriggerEvent
    -- ^ The knock in.
  knockOut : Optional TriggerEvent
    -- ^ The knock out.
    deriving (Eq, Ord, Show)

-- | The pricing period per calculation period if the
--   pricing days do not wholly fall within the respective
--   calculation period.
data Lag = Lag with 
  lagDuration : Offset
    -- ^ Defines the offset of the series of pricing dates
    --   relative to the calculation period.
  firstObservationDateOffset : Optional Offset
    -- ^ Defines the offset of the series of pricing dates
    --   relative to the calculation period.
    deriving (Eq, Ord, Show)

-- | The specification of a legal agreement between two
--   parties, being negotiated or having been executed.
--   This includes the baseline information and the
--   optional specialised elections
data LegalAgreement = LegalAgreement with 
  agreementDate : Optional Date
    -- ^ The date on which the legal agreement has been agreed
    --   between the parties. This corresponds to the Date of
    --   Deed in an English Law document.
  effectiveDate : Optional Date
    -- ^ The date on which, or as of which, the agreement is
    --   effective, if different from the agreement date. It
    --   is expected that it will most often correspond to the
    --   agreement date, although there could be situations
    --   where the parties will explicitly agree on a distinct
    --   effective date.
  identifier : [Identifier]
    -- ^ The legal agreement identifier. Several identifiers
    --   can be specified.
  legalAgreementIdentification : LegalAgreementIdentification
    -- ^ The type of legal agreement, identified via a set of
    --   composable attributes: agreementName, publisher,
    --   governing law and version, e.g. ISDA 2013 Standard
    --   Credit Support Annex English Law.
  contractualParty : [ReferenceWithMeta Party]
    -- ^ The two contractual parties to the legal agreement,
    --   which reference information is positioned as part of
    --   the partyInformation attribute.
  otherParty : [PartyRole]
    -- ^ The role(s) that other party(ies) may have in
    --   relation to the legal agreement, further to the
    --   contractual parties.
  attachment : [Resource]
    -- ^ A human readable document, for example a
    --   confirmation.
  agreementTerms : Optional AgreementTerms
    -- ^ Specification of the content of the legal agreement.
  relatedAgreements : [LegalAgreement]
    -- ^ Specifies the agreement(s) that govern the agreement,
    --   either as a reference to such agreements when
    --   specified as part of the CDM, or through
    --   identification of some of the key terms of those
    --   agreements, such as the type of agreement, the
    --   publisher, the vintage, the agreement identifier and
    --   the agreement date.
  umbrellaAgreement : Optional UmbrellaAgreement
    -- ^ The determination of whether Umbrella Agreement terms
    --   are applicable (True) or Not Applicable (False).
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | Specifies the legal agreement baseline information,
--   being negotiated or having been executed. It excludes
--   specialized elections
data LegalAgreementBase = LegalAgreementBase with 
  agreementDate : Optional Date
    -- ^ The date on which the legal agreement has been agreed
    --   between the parties. This corresponds to the Date of
    --   Deed in an English Law document.
  effectiveDate : Optional Date
    -- ^ The date on which, or as of which, the agreement is
    --   effective, if different from the agreement date. It
    --   is expected that it will most often correspond to the
    --   agreement date, although there could be situations
    --   where the parties will explicitly agree on a distinct
    --   effective date.
  identifier : [Identifier]
    -- ^ The legal agreement identifier. Several identifiers
    --   can be specified.
  legalAgreementIdentification : LegalAgreementIdentification
    -- ^ The type of legal agreement, identified via a set of
    --   composable attributes: agreementName, publisher,
    --   governing law and version, e.g. ISDA 2013 Standard
    --   Credit Support Annex English Law.
  contractualParty : [ReferenceWithMeta Party]
    -- ^ The two contractual parties to the legal agreement,
    --   which reference information is positioned as part of
    --   the partyInformation attribute.
  otherParty : [PartyRole]
    -- ^ The role(s) that other party(ies) may have in
    --   relation to the legal agreement, further to the
    --   contractual parties.
  attachment : [Resource]
    -- ^ A human readable document, for example a
    --   confirmation.
    deriving (Eq, Ord, Show)

-- | Specifies the type of legal agreement, identified via
--   a set of composable attributes: agreementName,
--   publisher, governing law and version, e.g. ISDA 2013
--   Standard Credit Support Annex English Law.
data LegalAgreementIdentification = LegalAgreementIdentification with 
  governingLaw : Optional GoverningLawEnum
    -- ^ The law governing the legal agreement, e.g. English
    --   Law, New York Law or Japanese Law.
  agreementName : AgreementName
    -- ^ The legal agreement name, e.g. Credit Support Annex
    --   for Variation Margin.
  publisher : Optional LegalAgreementPublisherEnum
    -- ^ The legal agreement publisher, e.g. ISDA.
  vintage : Optional Int
    -- ^ In the case where successive definitions of the legal
    --   agreement have been developed, the vintage
    --   identification. This is typically (but not
    --   necessarily) done by referencing the year, e.g. 2013
    --   in the case of the ISDA 2013 Standard Credit Support
    --   Annex.
    deriving (Eq, Ord, Show)

-- | A class to specify a legal entity, with a required
--   name and an optional entity identifier (such as the
--   LEI).
data LegalEntity = LegalEntity with 
  entityId : [FieldWithMeta Text]
    -- ^ A legal entity identifier (e.g. RED entity code).
  name : (FieldWithMeta Text)
    -- ^ The legal entity name.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

data LimitApplicable = LimitApplicable with 
  limitType : Optional (FieldWithMeta CreditLimitTypeEnum)
    -- ^ Standard code to indicate which type of credit line
    --   is being referred to - i.e. IM, DV01, PV01, CS01,
    --   Notional, Clip Size, Notional, maximumOrderQuantity.
  clipSize : Optional Int
    -- ^ This element is required in FpML, optional in CDM for
    --   the purpose of accommodating the CME data
    --   representation while making reference to the FpML
    --   one.
  amountUtilized : Optional Decimal
    -- ^ The limit utilised by all the cleared trades for the
    --   limit level and limit type. While the attribute is of
    --   type integer in FpML and the CME schema, it has been
    --   specified to be of type number in the CDM to take
    --   into consideration java size limits as well as for
    --   consistency purposes with the way most monetary
    --   amounts are expressed.
  utilization : Optional CreditLimitUtilisation
  amountRemaining : Optional Decimal
    -- ^ The limit remaining for the limit level and limit
    --   type. This does not take into account any pending
    --   trades. While the attribute is of type integer in
    --   FpML and the CME schema, it has been specified to be
    --   of type number in the CDM to take into consideration
    --   java size limits as well as for consistency purposes
    --   with the way most monetary amounts are expressed.
  currency : Optional (FieldWithMeta Text)
    -- ^ The currency in which the applicable limit is
    --   denominated. The list of valid currencies is not
    --   presently positioned as an enumeration as part of the
    --   CDM because that scope is limited to the values
    --   specified by ISDA and FpML. As a result, implementers
    --   have to make reference to the relevant standard, such
    --   as the ISO 4217 standard for currency codes.
  velocity : Optional Velocity
    deriving (Eq, Ord, Show)

-- | A class to represent the CDM attributes that are not
--   part of the FpML standard. Once broader usage is
--   confirmed, it is expected that those two classes can
--   be collapsed.
data LimitApplicableExtended = LimitApplicableExtended with 
  limitType : Optional (FieldWithMeta CreditLimitTypeEnum)
    -- ^ Standard code to indicate which type of credit line
    --   is being referred to - i.e. IM, DV01, PV01, CS01,
    --   Notional, Clip Size, Notional, maximumOrderQuantity.
  clipSize : Optional Int
    -- ^ This element is required in FpML, optional in CDM for
    --   the purpose of accommodating the CME data
    --   representation while making reference to the FpML
    --   one.
  amountUtilized : Optional Decimal
    -- ^ The limit utilised by all the cleared trades for the
    --   limit level and limit type. While the attribute is of
    --   type integer in FpML and the CME schema, it has been
    --   specified to be of type number in the CDM to take
    --   into consideration java size limits as well as for
    --   consistency purposes with the way most monetary
    --   amounts are expressed.
  utilization : Optional CreditLimitUtilisation
  amountRemaining : Optional Decimal
    -- ^ The limit remaining for the limit level and limit
    --   type. This does not take into account any pending
    --   trades. While the attribute is of type integer in
    --   FpML and the CME schema, it has been specified to be
    --   of type number in the CDM to take into consideration
    --   java size limits as well as for consistency purposes
    --   with the way most monetary amounts are expressed.
  currency : Optional (FieldWithMeta Text)
    -- ^ The currency in which the applicable limit is
    --   denominated. The list of valid currencies is not
    --   presently positioned as an enumeration as part of the
    --   CDM because that scope is limited to the values
    --   specified by ISDA and FpML. As a result, implementers
    --   have to make reference to the relevant standard, such
    --   as the ISO 4217 standard for currency codes.
  velocity : Optional Velocity
  limitLevel : Optional (FieldWithMeta LimitLevelEnum)
    -- ^ The level at which the limit is set: customer
    --   business, proprietary business or account level. This
    --   attribute is specified as a string as part of the CME
    --   clearing confirmation specification.
  limitAmount : Optional Decimal
    -- ^ The total limit available for the limit level and
    --   limit type. While the attribute is of type integer in
    --   the CME schema, it has been specified to be of type
    --   number in the CDM to take into consideration java
    --   size limits as well as for consistency purposes with
    --   the way most monetary amounts are expressed.
  limitImpactDueToTrade : Optional Decimal
    -- ^ The limit utilized by this specific trade. While the
    --   attribute is of type integer in the CME schema, it
    --   has been specified to be of type number in the CDM to
    --   take into consideration java size limits as well as
    --   for consistency purposes with the way most monetary
    --   amounts are expressed.
    deriving (Eq, Ord, Show)

-- | A class to provide lineage information across
--   lifecycle events through a pointer or set of pointers
--   into the event(s), contract(s) and, possibly, payout
--   components that the event is dependent on or relates
--   to. As an example, if an contractFormation event is
--   corrected, the correction event will have a lineage
--   into the initial event, which takes the form of a
--   globalKey into that initial contract formation event.
--   Two referencing mechanisms are provided as part of
--   the CDM: either the globalKey, which corresponds to
--   the hash value of the CDM class which is referred to,
--   or a reference qualifier which is meant to provide
--   support for the ingestion of xml documents with
--   id/href mechanisms. The CDM recommends the use of the
--   globalKey and provides a default implementation which
--   is accessible in the generated code through
--   org.isda.cdm.globalKey.GlobalKeyHashCalculator. If
--   implementers want to use an alternative hashing
--   mechanism, the API in which they need to plug it is
--   com.rosetta.model.lib.HashFunction.
data Lineage = Lineage with 
  tradeReference : [ReferenceWithMeta Trade]
  eventReference : [ReferenceWithMeta WorkflowStep]
    -- ^ The reference to the instantiation of an Event
    --   object, either through a globalKey or an xml-derived
    --   id/href mechanism. The definition associated to the
    --   Lineage class provides more details with respect to
    --   those referencing approaches, their expected usage
    --   and available implementation.
  portfolioStateReference : [ReferenceWithMeta PortfolioState]
    -- ^ The reference to the previous state of a Portfolio,
    --   in a chain of Events leading up to a build of that
    --   Portfolio as the holding of Product(s) in specific
    --   Quantity(ies). As part of the PortfolioState object,
    --   a pointer to the previous PortfolioState is provided
    --   through a Lineage object, together with pointer(s) to
    --   the Event or set of Events leading up to the current
    --   (new) state.
    deriving (Eq, Ord, Show)

-- | A securitized derivative on another asset.
data ListedDerivative = ListedDerivative with 
  identifier : [AssetIdentifier]
    -- ^ Asset Identifiers are used to uniquely identify an
    --   Asset, using a specified Asset Identifier Type.
  taxonomy : [Taxonomy]
    -- ^ Defines the taxonomy of an object by combining a
    --   taxonomy source (i.e. the rules to classify the
    --   object) and a value (i.e. the output of those rules
    --   on the object.
  isExchangeListed : Optional Bool
    -- ^ Defines whether the Asset is listed on a public
    --   exchange.
  exchange : Optional LegalEntity
    -- ^ If the Asset is listed, defines the public exchange
    --   of the listing.
  relatedExchange : [LegalEntity]
    -- ^ Provides the related Exchanges, if applicable.
  instrumentType : InstrumentTypeEnum
    -- ^ Identifies the type of an instrument using an
    --   enumerated list.
  deliveryTerm : Optional Text
    -- ^ Also called contract month or delivery month.
    --   However, it's not always a month. It is usually
    --   expressed using a code, e.g. Z23 would be the Dec
    --   2023 contract, (Z = December). For crude oil, the
    --   corresponding contract might be called CLZ23.
    --   Optional as this can be uniquely identified in the
    --   identifier.
  optionType : Optional PutCallEnum
    -- ^ The type of option, ie Put or Call. Left empty if it
    --   is a Future.
  strike : Optional Decimal
    -- ^ Specifies the strike of the option.
    deriving (Eq, Ord, Show)

-- | Specifies a filter based on an underlying corporate
--   financial official listing defined at a stock
--   exchange.
data ListingType = ListingType with 
  exchange : [FieldWithMeta Text]
    -- ^ Represents a filter based on the Primary Stock
    --   Exchange facilitating the listing of companies,
    --   exchange of Stocks, Exchange traded Derivatives,
    --   Bonds, and other Securities expressed in ISO standard
    --   10383.
  sector : [FieldWithMeta Text]
    -- ^ Represents a filter based on an industry sector
    --   defined under a system for classifying industry types
    --   such as Global Industry Classification Standard
    --   (GICS) and North American Industry Classification
    --   System (NAICS)
  index : [Index]
    -- ^ Represents a filter based on an index that measures a
    --   stock market, or a subset of a stock market.
    deriving (Eq, Ord, Show)

-- | Identifies a loan by referencing an asset identifier
--   and through an optional set of attributes.
data Loan = Loan with 
  identifier : [AssetIdentifier]
    -- ^ Asset Identifiers are used to uniquely identify an
    --   Asset, using a specified Asset Identifier Type.
  taxonomy : [Taxonomy]
    -- ^ Defines the taxonomy of an object by combining a
    --   taxonomy source (i.e. the rules to classify the
    --   object) and a value (i.e. the output of those rules
    --   on the object.
  isExchangeListed : Optional Bool
    -- ^ Defines whether the Asset is listed on a public
    --   exchange.
  exchange : Optional LegalEntity
    -- ^ If the Asset is listed, defines the public exchange
    --   of the listing.
  relatedExchange : [LegalEntity]
    -- ^ Provides the related Exchanges, if applicable.
  instrumentType : InstrumentTypeEnum
    -- ^ Identifies the type of an instrument using an
    --   enumerated list.
  borrower : [LegalEntity]
    -- ^ Specifies the borrower. There can be more than one
    --   borrower. It is meant to be used in the event that
    --   there is no Bloomberg Id or the Secured List
    --   isn't applicable.
  lien : Optional (FieldWithMeta Text)
    -- ^ Specifies the seniority level of the lien.
  facilityType : Optional (FieldWithMeta Text)
    -- ^ Specifies the type of loan facility (letter of
    --   credit, revolving, ...).
  creditAgreementDate : Optional Date
    -- ^ Specifies the credit agreement date is the closing
    --   date (the date where the agreement has been signed)
    --   for the loans in the credit agreement. Funding of the
    --   facilities occurs on (or sometimes a little after)
    --   the Credit Agreement date. This underlier attribute
    --   is used to help identify which of the company's
    --   outstanding loans are being referenced by knowing to
    --   which credit agreement it belongs. ISDA Standards
    --   Terms Supplement term: Date of Original Credit
    --   Agreement.
  tranche : Optional (FieldWithMeta Text)
    -- ^ Denotes the loan tranche that is subject to the
    --   derivative transaction. It will typically be
    --   referenced as the Bloomberg tranche number. ISDA
    --   Standards Terms Supplement term: Bloomberg Tranche
    --   Number.
    deriving (Eq, Ord, Show)

-- | A class to specify loan with a participation
--   agreement whereby the buyer is capable of creating,
--   or procuring the creation of, a contractual right in
--   favour of the seller that provides the seller with
--   recourse to the participation seller for a specified
--   share in any payments due under the relevant loan
--   which are received by the participation seller. ISDA
--   2003 Term: Direct Loan Participation.
data LoanParticipation = LoanParticipation with 
  applicable : Bool
    -- ^ Indicates whether the provision is applicable.
  partialCashSettlement : Optional Bool
    -- ^ Specifies whether either 'Partial Cash Settlement
    --   of Assignable Loans', 'Partial Cash
    --   Settlement of Consent Required Loans' or
    --   'Partial Cash Settlement of Participations'
    --   is applicable. If this element is specified and
    --   Assignable Loan is a Deliverable Obligation
    --   Characteristic, any Assignable Loan that is
    --   deliverable, but where a non-receipt of Consent by
    --   the Physical Settlement Date has occurred, the Loan
    --   can be cash settled rather than physically delivered.
    --   If this element is specified and Consent Required
    --   Loan is a Deliverable Obligation Characteristic, any
    --   Consent Required Loan that is deliverable, but where
    --   a non-receipt of Consent by the Physical Settlement
    --   Date has occurred, the Loan can be cash settled
    --   rather than physically delivered. If this element is
    --   specified and Direct Loan Participation is a
    --   Deliverable Obligation Characteristic, any
    --   Participation that is deliverable, but where this
    --   participation has not been effected (has not come
    --   into effect) by the Physical Settlement Date, the
    --   participation can be cash settled rather than
    --   physically delivered.
  qualifyingParticipationSeller : Optional Text
    -- ^ If Direct Loan Participation is specified as a
    --   deliverable obligation characteristic, this specifies
    --   any requirements for the Qualifying Participation
    --   Seller. The requirements may be listed free-form.
    --   ISDA 2003 Term: Qualifying Participation Seller.
    deriving (Eq, Ord, Show)

-- | Specifies a location identifier. An issuer and an
--   identifier type can be associated with the actual
--   identifier value as a way to properly qualify it.
data LocationIdentifier = LocationIdentifier with 
  issuerReference : Optional (ReferenceWithMeta Party)
    -- ^ The identifier issuer, when specified by reference to
    --   a party specified as part of the transaction.
  issuer : Optional (FieldWithMeta Text)
    -- ^ The identifier issuer, when specified explicitly
    --   alongside the identifier value (instead of being
    --   specified by reference to a party).
  assignedIdentifier : [AssignedIdentifier]
    -- ^ The identifier value. This level of indirection
    --   between the issuer and the identifier and its version
    --   provides the ability to associate multiple
    --   identifiers to one issuer, consistently with the FpML
    --   PartyTradeIdentifier.
  meta : Optional MetaFields
  locationIdentifierType : Optional CommodityLocationIdentifierTypeEnum
    -- ^ Specifies the nature of a location identifier.
    deriving (Eq, Ord, Show)

-- | A class to specify the amount to be paid by the buyer
--   of the option if the option is exercised prior to the
--   Early Call Date (typically applicable to the
--   convertible bond options).
data MakeWholeAmount = MakeWholeAmount with 
  floatingRateIndex : FloatingRateIndexEnum
  indexTenor : Optional Period
    -- ^ The ISDA Designated Maturity, i.e. the tenor of the
    --   floating rate.
  spread : Decimal
    -- ^ Spread in basis points over the floating rate index.
  side : Optional QuotationSideEnum
    -- ^ The side (bid/mid/ask) of the measure.
  interpolationMethod : Optional InterpolationMethodEnum
    -- ^ The type of interpolation method that the calculation
    --   agent reserves the right to use.
  earlyCallDate : (FieldWithMeta Date)
    -- ^ Date prior to which the option buyer will have to pay
    --   a Make Whole Amount to the option seller if he/she
    --   exercises the option.
    deriving (Eq, Ord, Show)

-- | A data to:  define an early termination provision for
--   which exercise is mandatory.
data MandatoryEarlyTermination = MandatoryEarlyTermination with 
  mandatoryEarlyTerminationDate : AdjustableDate
    -- ^ The early termination date associated with a
    --   mandatory early termination of a swap.
  calculationAgent : CalculationAgent
    -- ^ The ISDA Calculation Agent responsible for performing
    --   duties associated with an optional early termination.
  cashSettlement : SettlementTerms
    -- ^ If specified, this means that cash settlement is
    --   applicable to the transaction and defines the
    --   parameters associated with the cash settlement
    --   procedure. If not specified, then physical settlement
    --   is applicable.
  mandatoryEarlyTerminationAdjustedDates : Optional MandatoryEarlyTerminationAdjustedDates
    -- ^ The adjusted dates associated with a mandatory early
    --   termination provision. These dates have been adjusted
    --   for any applicable business day convention.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A data defining:  the adjusted dates associated with
--   a mandatory early termination provision.
data MandatoryEarlyTerminationAdjustedDates = MandatoryEarlyTerminationAdjustedDates with 
  adjustedEarlyTerminationDate : Date
    -- ^ The early termination date that is applicable if an
    --   early termination provision is exercised. This date
    --   should already be adjusted for any applicable
    --   business day convention.
  adjustedCashSettlementValuationDate : Date
    -- ^ The date by which the cash settlement amount must be
    --   agreed. This date should already be adjusted for any
    --   applicable business day convention.
  adjustedCashSettlementPaymentDate : Date
    -- ^ The date on which the cash settlement amount is paid.
    --   This date should already be adjusted for any
    --   applicable business date convention.
    deriving (Eq, Ord, Show)

-- | A class defining manual exercise, i.e. that the
--   option buyer counterparty must give notice to the
--   option seller of exercise.
data ManualExercise = ManualExercise with 
  exerciseNotice : Optional ExerciseNotice
    -- ^ Definition of the party to whom notice of exercise
    --   should be given.
  fallbackExercise : Optional Bool
    -- ^ If fallback exercise is specified then the notional
    --   amount of the underlying swap, not previously
    --   exercised under the swaption, will be automatically
    --   exercised at the expiration time on the expiration
    --   date if at such time the buyer is in-the-money,
    --   provided that the difference between the settlement
    --   rate and the fixed rate under the relevant underlying
    --   swap is not less than one tenth of a percentage point
    --   (0.10% or 0.001). The term in-the-money is assumed to
    --   have the meaning defined in the 2000 ISDA
    --   Definitions, Section 17.4. In-the-money.
    deriving (Eq, Ord, Show)

-- | Represents common attributes required for Issuance
--   and Response to a Margin Call action as a result of a
--   demand for delivery or return of collateral
--   determined under a legal agreement such as a credit
--   support document or equivalent.
data MarginCallBase = MarginCallBase with 
  instructionType : MarginCallInstructionType
    -- ^ Identifies the enumeration values to specify the call
    --   notification type, direction, specific action type.
  party : [Party]
    -- ^ Represents the parties to the margin call. The
    --   cardinality is optional to address the case where
    --   both parties of the event are specified and a third
    --   party if applicable.
  partyRole : [PartyRole]
    -- ^ Represents the role each specified party takes in the
    --   margin call. further to the principal roles, payer
    --   and receiver.
  clearingBroker : Optional Party
    -- ^ Indicates the name of the Clearing Broker FCM/DCM.
  callIdentifier : Optional Identifier
    -- ^ Represents a unique Identifier for a margin call
    --   message, that can be referenced throughout all points
    --   of the process.
  callAgreementType : AgreementName
    -- ^ Specifies the legal agreement type the margin call is
    --   generated from and governed by.
  agreementMinimumTransferAmount : Optional Money
    -- ^ Specifies the collateral legal agreement minimum
    --   transfer amount in base currency.
  agreementThreshold : Optional Money
    -- ^ Specifies the collateral legal agreement threshold
    --   amount in base currency.
  agreementRounding : Optional Money
    -- ^ Specifies the collateral legal agreement rounding in
    --   base currency.
  regMarginType : RegMarginTypeEnum
    -- ^ Identifies margin type and if related regulatory
    --   mandate
  regIMRole : Optional RegIMRoleEnum
    -- ^ Indicates the role of the party in an regulatory
    --   initial margin call instruction (i.e Pledgor party or
    --   Secured party).
  baseCurrencyExposure : Optional MarginCallExposure
    -- ^ Represents the current mark to market value or IM
    --   calculation value of the trade portfolio as recorded
    --   by the principle (in base currency), to be referenced
    --   in a margin call.
  collateralPortfolio : Optional (ReferenceWithMeta CollateralPortfolio)
    -- ^ Represents attributes to define the details of
    --   collateral assets within a collateral portfolio to be
    --   used in margin call messaging and contribute to
    --   collateral balances e.g securities in a collateral
    --   account recorded by the principal as held or posted.
  independentAmountBalance : Optional CollateralBalance
    -- ^ Represents additional credit support amount over and
    --   above mark to market value.
    deriving (Eq, Ord, Show)

-- | Represents attributes required for mark to market
--   value or IM calculation value of the trade portfolio
--   as recorded by the principle (in base currency).
data MarginCallExposure = MarginCallExposure with 
  instructionType : MarginCallInstructionType
    -- ^ Identifies the enumeration values to specify the call
    --   notification type, direction, specific action type.
  party : [Party]
    -- ^ Represents the parties to the margin call. The
    --   cardinality is optional to address the case where
    --   both parties of the event are specified and a third
    --   party if applicable.
  partyRole : [PartyRole]
    -- ^ Represents the role each specified party takes in the
    --   margin call. further to the principal roles, payer
    --   and receiver.
  clearingBroker : Optional Party
    -- ^ Indicates the name of the Clearing Broker FCM/DCM.
  callIdentifier : Optional Identifier
    -- ^ Represents a unique Identifier for a margin call
    --   message, that can be referenced throughout all points
    --   of the process.
  callAgreementType : AgreementName
    -- ^ Specifies the legal agreement type the margin call is
    --   generated from and governed by.
  agreementMinimumTransferAmount : Optional Money
    -- ^ Specifies the collateral legal agreement minimum
    --   transfer amount in base currency.
  agreementThreshold : Optional Money
    -- ^ Specifies the collateral legal agreement threshold
    --   amount in base currency.
  agreementRounding : Optional Money
    -- ^ Specifies the collateral legal agreement rounding in
    --   base currency.
  regMarginType : RegMarginTypeEnum
    -- ^ Identifies margin type and if related regulatory
    --   mandate
  regIMRole : Optional RegIMRoleEnum
    -- ^ Indicates the role of the party in an regulatory
    --   initial margin call instruction (i.e Pledgor party or
    --   Secured party).
  baseCurrencyExposure : Optional MarginCallExposure
    -- ^ Represents the current mark to market value or IM
    --   calculation value of the trade portfolio as recorded
    --   by the principle (in base currency), to be referenced
    --   in a margin call.
  collateralPortfolio : Optional (ReferenceWithMeta CollateralPortfolio)
    -- ^ Represents attributes to define the details of
    --   collateral assets within a collateral portfolio to be
    --   used in margin call messaging and contribute to
    --   collateral balances e.g securities in a collateral
    --   account recorded by the principal as held or posted.
  independentAmountBalance : Optional CollateralBalance
    -- ^ Represents additional credit support amount over and
    --   above mark to market value.
  overallExposure : Exposure
    -- ^ Represents the whole overall mark to market value or
    --   IM calculation value of the trade portfolio as
    --   recorded by the principle (in base currency).
  simmIMExposure : Optional Exposure
    -- ^ Represents Initial Margin (IM) exposure derived from
    --   ISDA SIMM calculation.
  scheduleGridIMExposure : Optional Exposure
    -- ^ Represents Initial Margin (IM) exposure derived from
    --   schedule or Grid calculation.
    deriving (Eq, Ord, Show)

-- | Represents enumeration values to specify the call
--   notification type, direction, specific action type.
data MarginCallInstructionType = MarginCallInstructionType with 
  callType : CallTypeEnum
    -- ^ Indicates the status of the call message type, such
    --   as expected call, notification of a call or an
    --   actionable margin call.
  visibilityIndicator : Optional Bool
    -- ^ Indicates the choice if the call instruction is
    --   visible or not to the other party.
    deriving (Eq, Ord, Show)

-- | Represents common attributes required for a Margin
--   Call Issuance under a legal agreement such as a
--   credit support document or equivalent.
data MarginCallIssuance = MarginCallIssuance with 
  instructionType : MarginCallInstructionType
    -- ^ Identifies the enumeration values to specify the call
    --   notification type, direction, specific action type.
  party : [Party]
    -- ^ Represents the parties to the margin call. The
    --   cardinality is optional to address the case where
    --   both parties of the event are specified and a third
    --   party if applicable.
  partyRole : [PartyRole]
    -- ^ Represents the role each specified party takes in the
    --   margin call. further to the principal roles, payer
    --   and receiver.
  clearingBroker : Optional Party
    -- ^ Indicates the name of the Clearing Broker FCM/DCM.
  callIdentifier : Optional Identifier
    -- ^ Represents a unique Identifier for a margin call
    --   message, that can be referenced throughout all points
    --   of the process.
  callAgreementType : AgreementName
    -- ^ Specifies the legal agreement type the margin call is
    --   generated from and governed by.
  agreementMinimumTransferAmount : Optional Money
    -- ^ Specifies the collateral legal agreement minimum
    --   transfer amount in base currency.
  agreementThreshold : Optional Money
    -- ^ Specifies the collateral legal agreement threshold
    --   amount in base currency.
  agreementRounding : Optional Money
    -- ^ Specifies the collateral legal agreement rounding in
    --   base currency.
  regMarginType : RegMarginTypeEnum
    -- ^ Identifies margin type and if related regulatory
    --   mandate
  regIMRole : Optional RegIMRoleEnum
    -- ^ Indicates the role of the party in an regulatory
    --   initial margin call instruction (i.e Pledgor party or
    --   Secured party).
  baseCurrencyExposure : Optional MarginCallExposure
    -- ^ Represents the current mark to market value or IM
    --   calculation value of the trade portfolio as recorded
    --   by the principle (in base currency), to be referenced
    --   in a margin call.
  collateralPortfolio : Optional (ReferenceWithMeta CollateralPortfolio)
    -- ^ Represents attributes to define the details of
    --   collateral assets within a collateral portfolio to be
    --   used in margin call messaging and contribute to
    --   collateral balances e.g securities in a collateral
    --   account recorded by the principal as held or posted.
  independentAmountBalance : Optional CollateralBalance
    -- ^ Represents additional credit support amount over and
    --   above mark to market value.
  callAmountInBaseCurrency : Money
    -- ^ Specifies the amount of margin being called for which
    --   accounts for margin calculation inclusive of
    --   exposure, independent amount,threshold,collateral
    --   balance, MTA, rounding increments (in base currency
    --   detailed in supporting collateral agreement).
  recallNonCashCollateralDescription : [EligibleCollateralCriteria]
    -- ^ Specifies the details to describe or identify
    --   non-cash collateral eligible assets for recall
    --   purposes.
    deriving (Eq, Ord, Show)

-- | Represents common attributes required for a Margin
--   Call Response under a legal agreement such as a
--   credit support document or equivalent.
data MarginCallResponse = MarginCallResponse with 
  instructionType : MarginCallInstructionType
    -- ^ Identifies the enumeration values to specify the call
    --   notification type, direction, specific action type.
  party : [Party]
    -- ^ Represents the parties to the margin call. The
    --   cardinality is optional to address the case where
    --   both parties of the event are specified and a third
    --   party if applicable.
  partyRole : [PartyRole]
    -- ^ Represents the role each specified party takes in the
    --   margin call. further to the principal roles, payer
    --   and receiver.
  clearingBroker : Optional Party
    -- ^ Indicates the name of the Clearing Broker FCM/DCM.
  callIdentifier : Optional Identifier
    -- ^ Represents a unique Identifier for a margin call
    --   message, that can be referenced throughout all points
    --   of the process.
  callAgreementType : AgreementName
    -- ^ Specifies the legal agreement type the margin call is
    --   generated from and governed by.
  agreementMinimumTransferAmount : Optional Money
    -- ^ Specifies the collateral legal agreement minimum
    --   transfer amount in base currency.
  agreementThreshold : Optional Money
    -- ^ Specifies the collateral legal agreement threshold
    --   amount in base currency.
  agreementRounding : Optional Money
    -- ^ Specifies the collateral legal agreement rounding in
    --   base currency.
  regMarginType : RegMarginTypeEnum
    -- ^ Identifies margin type and if related regulatory
    --   mandate
  regIMRole : Optional RegIMRoleEnum
    -- ^ Indicates the role of the party in an regulatory
    --   initial margin call instruction (i.e Pledgor party or
    --   Secured party).
  baseCurrencyExposure : Optional MarginCallExposure
    -- ^ Represents the current mark to market value or IM
    --   calculation value of the trade portfolio as recorded
    --   by the principle (in base currency), to be referenced
    --   in a margin call.
  collateralPortfolio : Optional (ReferenceWithMeta CollateralPortfolio)
    -- ^ Represents attributes to define the details of
    --   collateral assets within a collateral portfolio to be
    --   used in margin call messaging and contribute to
    --   collateral balances e.g securities in a collateral
    --   account recorded by the principal as held or posted.
  independentAmountBalance : Optional CollateralBalance
    -- ^ Represents additional credit support amount over and
    --   above mark to market value.
  marginCallResponseAction : [MarginCallResponseAction]
    -- ^ Specifies the margin call action details, including
    --   collateral to be moved and direction.
  marginResponseType : MarginCallResponseTypeEnum
    -- ^ Indicates the response type, such as, is the margin
    --   call response a 'full' 'part'
    --   agreement or 'dispute'.
  agreedAmountBaseCurrency : Money
    -- ^ Indicates the amount that posting entity agrees to
    --   remit in response to margin call (in base currency).
    deriving (Eq, Ord, Show)

-- | Specifies the margin call action details, including
--   collateral to be moved and its direction.
data MarginCallResponseAction = MarginCallResponseAction with 
  collateralPositionComponent : [CollateralPosition]
    -- ^ Specifies the collateral to be moved and its
    --   direction.
  marginCallAction : MarginCallActionEnum
    -- ^ Specifies the margin call action details, specified
    --   as either Delivery or Return.
    deriving (Eq, Ord, Show)

-- | Defines clauses that make up a Master Agreement
data MasterAgreementClause = MasterAgreementClause with 
  identifer : MasterAgreementClauseIdentifierEnum
    -- ^ Unique identifier for the clause
  name : Optional Text
    -- ^ Optional textual description of the clause.
  counterparty : [CounterpartyRoleEnum]
    -- ^ Optional counterparty role. This can be used where a
    --   clause needs to be assigned to a specific party on
    --   the agreement based upon their role i.e. Party A or
    --   Party B.
  otherParty : [PartyRoleEnum]
    -- ^ Optional party. This can be required for umbrella
    --   agreements where a clause may need to be assigned to
    --   a specific party who may or may not be on the
    --   agreement.
  variant : [MasterAgreementClauseVariant]
    -- ^ Allows multiple variants to be defined for a clause.
    --   This needs to be an array as some clauses can specify
    --   different variants for different parties. At least
    --   one variant must be specified for a clause.
    deriving (Eq, Ord, Show)

-- | Sets the details for a specific variant associated to
--   a clause in a Master Agreement
data MasterAgreementClauseVariant = MasterAgreementClauseVariant with 
  identifier : MasterAgreementVariantIdentifierEnum
    -- ^ Unique identifier for this variant
  name : Optional Text
    -- ^ Optional textual description of the variant.
  counterparty : [CounterpartyRoleEnum]
    -- ^ Optional counterparty role. This can be used where a
    --   clause needs to assign a different variant to the
    --   different parties on the agreement based upon their
    --   role i.e. Party A or Party B.
  otherParty : [PartyRoleEnum]
    -- ^ Optional party. This can be used where a clause needs
    --   to assign different variants to different parties who
    --   may or may not be on the agreement.
  variableSet : [MasterAgreementVariableSet]
    -- ^ For some variants of some clauses additional details
    --   are required to work out what has been elected. This
    --   array can be used to define the name and value of
    --   these variables. Please refer to the agreement
    --   documentation for more details of the variables that
    --   are available for any clause.
    deriving (Eq, Ord, Show)

-- | The set of elections which specify a Master
--   Agreement.
data MasterAgreementSchedule = MasterAgreementSchedule with 
  clause : [MasterAgreementClause]
    -- ^ Clauses that have had elections made against them in
    --   this Master Agreement. There must be at least one
    --   clause defined in the agreement.
    deriving (Eq, Ord, Show)

-- | Defines a type where additional variables associated
--   to clauses and their variants can be described.
data MasterAgreementVariableSet = MasterAgreementVariableSet with 
  variableSet : [MasterAgreementVariableSet]
    -- ^ For some variants a table of variables is required.
    --   To support this use case we need to be able to
    --   specify variables within variables. Including a
    --   variable set here gives us infinite nesting
    --   opportunities - realistically we are only ever
    --   expecting that a table would need to be defined for
    --   any particular clause, so we would expect two levels
    --   of nesting as a maximum i.e.
    --   variableSet->variableSet->name/value.
  name : Optional Text
    -- ^ The name of the variable
  value : Optional Text
    -- ^ The value for this variable
    deriving (Eq, Ord, Show)

-- | Legal agreement specification for General Terms and
--   Elections that are applicable across multiple
--   confirmations and are referenced by these
--   confirmations.
data MasterConfirmationBase = MasterConfirmationBase with 
    deriving (Eq, Ord, Show)

-- | Defines a concrete measure as a number associated to
--   a unit. It extends MeasureBase by requiring the value
--   attribute to be present. A measure may be unit-less
--   so the unit attribute is still optional.
data Measure = Measure with 
  value : Optional Decimal
    -- ^ Specifies the value of the measure as a number.
    --   Optional because in a measure vector or schedule,
    --   this single value may be omitted.
  unit : Optional UnitType
    -- ^ Qualifies the unit by which the amount is measured.
    --   Optional because a measure may be unit-less (e.g.
    --   when representing a ratio between amounts in the same
    --   unit).
    deriving (Eq, Ord, Show)

-- | Provides an abstract type to define a measure as a
--   number associated to a unit. This type is abstract
--   because all its attributes are optional. The types
--   that extend it can specify further existence
--   constraints.
data MeasureBase = MeasureBase with 
  value : Optional Decimal
    -- ^ Specifies the value of the measure as a number.
    --   Optional because in a measure vector or schedule,
    --   this single value may be omitted.
  unit : Optional UnitType
    -- ^ Qualifies the unit by which the amount is measured.
    --   Optional because a measure may be unit-less (e.g.
    --   when representing a ratio between amounts in the same
    --   unit).
    deriving (Eq, Ord, Show)

-- | A set of measures, all in the same unit, where the
--   values are defined through a schedule of steps. The
--   initial value may be defined either as part of the
--   steps, or using the single amount attribute.
data MeasureSchedule = MeasureSchedule with 
  value : Optional Decimal
    -- ^ Specifies the value of the measure as a number.
    --   Optional because in a measure vector or schedule,
    --   this single value may be omitted.
  unit : Optional UnitType
    -- ^ Qualifies the unit by which the amount is measured.
    --   Optional because a measure may be unit-less (e.g.
    --   when representing a ratio between amounts in the same
    --   unit).
  datedValue : [DatedValue]
    -- ^ A schedule of step date and value pairs. On each step
    --   date the associated step value becomes effective. The
    --   step dates are used to order the steps by ascending
    --   order. This attribute is optional so the data type
    --   may be used to define a schedule with a single value.
    deriving (Eq, Ord, Show)

-- | This class corresponds to the components of the FpML
--   MessageHeader.model.
data MessageInformation = MessageInformation with 
  messageId : (FieldWithMeta Text)
    -- ^ A unique identifier assigned to the message.
  sentBy : Optional (FieldWithMeta Text)
    -- ^ The identifier for the originator of a message
    --   instance.
  sentTo : [FieldWithMeta Text]
    -- ^ The identifier(s) for the recipient(s) of a message
    --   instance.
  copyTo : [FieldWithMeta Text]
    -- ^ A unique identifier (within the specified coding
    --   scheme) giving the details of some party to whom a
    --   copy of this message will be sent for reference.
    deriving (Eq, Ord, Show)

-- | Defines a monetary amount in a specified currency.
data Money = Money with 
  value : Optional Decimal
    -- ^ Specifies the value of the measure as a number.
    --   Optional because in a measure vector or schedule,
    --   this single value may be omitted.
  unit : Optional UnitType
    -- ^ Qualifies the unit by which the amount is measured.
    --   Optional because a measure may be unit-less (e.g.
    --   when representing a ratio between amounts in the same
    --   unit).
  datedValue : [DatedValue]
    -- ^ A schedule of step date and value pairs. On each step
    --   date the associated step value becomes effective. The
    --   step dates are used to order the steps by ascending
    --   order. This attribute is optional so the data type
    --   may be used to define a schedule with a single value.
  multiplier : Optional Measure
    -- ^ Defines an optional number that the quantity should
    --   be multiplied by to derive a total quantity. This
    --   number is associated to a unit. For example in the
    --   case of the Coal (API2) CIF ARA (ARGUS-McCloskey)
    --   Futures Contract on the CME, where the unit would be
    --   contracts, the multiplier value would 1,000 and the
    --   mulitiplier unit would be 1,000 MT (Metric Tons).
  frequency : Optional Frequency
    -- ^ Defines the frequency to be used when defining a
    --   quantity. For example a quantity may be specified as
    --   a number of barrels of oil per day, which needs
    --   multiplying by the number of days in the relevant
    --   period to get the total quantity as a number of
    --   barrels.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | The money bound is defined as a money amount and
--   whether the bound is inclusive.
data MoneyBound = MoneyBound with 
  money : Money
    -- ^ The money amount to be used as the bound, e.g. 1,000
    --   USD.
  inclusive : Bool
    -- ^ Whether the money amount bound is inclusive, e.g. for
    --   a lower bound, false would indicate greater than,
    --   whereas true would indicate greater than or equal to.
    deriving (Eq, Ord, Show)

-- | The money range defined as either a lower and upper
--   money bound, or both.
data MoneyRange = MoneyRange with 
  lowerBound : Optional MoneyBound
    -- ^ The lower bound of a money range, e.g. greater than
    --   or equal to 1,000 USD.
  upperBound : Optional MoneyBound
    -- ^ The upper bound of a money range, e.g. less than
    --   10,000 USD.
    deriving (Eq, Ord, Show)

-- | Represetns a class to specify multiple credit
--   notations alongside a conditional 'any' or
--   'all' qualifier.
data MultipleCreditNotations = MultipleCreditNotations with 
  condition : QuantifierEnum
    -- ^ An enumerated element, to qualify whether All or Any
    --   credit notation applies.
  creditNotation : [FieldWithMeta CreditNotation]
    -- ^ At least two credit notations much be specified.
  mismatchResolution : Optional CreditNotationMismatchResolutionEnum
  referenceAgency : Optional CreditRatingAgencyEnum
    deriving (Eq, Ord, Show)

-- | Represents a class to specify multiple credit debt
--   types alongside a conditional 'any' or
--   'all' qualifier.
data MultipleDebtTypes = MultipleDebtTypes with 
  condition : QuantifierEnum
    -- ^ An enumerated attribute, to qualify whether All or
    --   Any debt type applies.
  debtType : [FieldWithMeta Text]
    -- ^ The type of debt, e.g. long term debt, deposit, ...
    --   FpML doesn't specific a scheme value, hence no
    --   enumeration is specified as part of the CDM. At least
    --   two debt types much be specified.
    deriving (Eq, Ord, Show)

-- | A class defining multiple exercises. As defined in
--   the 2000 ISDA Definitions, Section 12.4. Multiple
--   Exercise, the buyer of the option has the right to
--   exercise all or less than all the unexercised
--   notional amount of the underlying swap on one or more
--   days in the exercise period, but on any such day may
--   not exercise less than the minimum notional amount or
--   more than the maximum notional amount, and if an
--   integral multiple amount is specified, the notional
--   exercised must be equal to or, be an integral
--   multiple of, the integral multiple amount. In FpML,
--   MultipleExercise is built upon the
--   PartialExercise.model.
data MultipleExercise = MultipleExercise with 
  notionaReference : (ReferenceWithMeta Money)
    -- ^ A pointer style reference to the associated notional
    --   schedule defined elsewhere in the document. This
    --   element has been made optional as part of its
    --   integration in the OptionBaseExtended, because not
    --   required for the options on securities.
  integralMultipleAmount : Optional Decimal
    -- ^ A notional amount which restricts the amount of
    --   notional that can be exercised when partial exercise
    --   or multiple exercise is applicable. The integral
    --   multiple amount defines a lower limit of notional
    --   that can be exercised and also defines a unit
    --   multiple of notional that can be exercised, i.e. only
    --   integer multiples of this amount can be exercised.
  minimumNotionalAmount : Optional Decimal
    -- ^ The minimum notional amount that can be exercised on
    --   a given exercise date. See multipleExercise.
  minimumNumberOfOptions : Optional Int
    -- ^ The minimum number of options that can be exercised
    --   on a given exercise date.
  maximumNotionalAmount : Optional Decimal
    -- ^ The maximum notional amount that can be exercised on
    --   a given exercise date.
  maximumNumberOfOptions : Optional Int
    -- ^ The maximum number of options that can be exercised
    --   on a given exercise date. If the number is not
    --   specified, it means that the maximum number of
    --   options corresponds to the remaining unexercised
    --   options.
    deriving (Eq, Ord, Show)

data MultipleValuationDates = MultipleValuationDates with 
  businessDays : Optional Int
    -- ^ A number of business days. Its precise meaning is
    --   dependant on the context in which this element is
    --   used. ISDA 2003 Term: Business Day.
  businessDaysThereafter : Optional Int
    -- ^ The number of business days between successive
    --   valuation dates when multiple valuation dates are
    --   applicable for cash settlement. ISDA 2003 Term:
    --   Business Days thereafter.
  numberValuationDates : Optional Int
    -- ^ Where multiple valuation dates are specified as being
    --   applicable for cash settlement, this element
    --   specifies (a) the number of applicable valuation
    --   dates, and (b) the number of business days after
    --   satisfaction of all conditions to settlement when the
    --   first such valuation date occurs, and (c) the number
    --   of business days thereafter of each successive
    --   valuation date. ISDA 2003 Term: Multiple Valuation
    --   Dates.
    deriving (Eq, Ord, Show)

-- | A class to represent the attributes that are specific
--   to a natural person.
data NaturalPerson = NaturalPerson with 
  personId : [FieldWithMeta PersonIdentifier]
    -- ^ The identifier associated with a person, e.g. the
    --   internal identification code.
  honorific : Optional Text
    -- ^ An honorific title, such as Mr., Ms., Dr. etc.
  firstName : Optional Text
    -- ^ The natural person's first name. It is optional
    --   in FpML.
  middleName : [Text]
    -- ^ The natural person's middle name(s). If a middle
    --   name is provided then an initial should be absent.
  initial : [Text]
    -- ^ The natural person's middle initial(s). If a
    --   middle initial is provided then a name should be
    --   absent.
  surname : Optional Text
    -- ^ The natural person's surname.
  suffix : Optional Text
    -- ^ Name suffix, such as Jr., III, etc.
  dateOfBirth : Optional Date
    -- ^ The natural person's date of birth.
  contactInformation : Optional ContactInformation
    -- ^ The contact information for such person, when
    --   different from the contact information associated
    --   with the party.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A class to specify the role(s) that natural person(s)
--   may have in relation to the contract.
data NaturalPersonRole = NaturalPersonRole with 
  personReference : (ReferenceWithMeta NaturalPerson)
    -- ^ A reference to the natural person to whom the role
    --   refers to.
  role : [FieldWithMeta NaturalPersonRoleEnum]
    -- ^ FpML specifies a person role that is distinct from
    --   the party role.
    deriving (Eq, Ord, Show)

data New = New with 
  txId : Text
  exctgPty : Text
  invstmtPtyInd : Text
  submitgPty : Text
  buyr : Buyr
  sellr : Sellr
  ordrTrnsmssn : OrdrTrnsmssn
  tx : Tx
  finInstrm : FinInstrm
  invstmtDcsnPrsn : InvstmtDcsnPrsn
  exctgPrsn : ExctgPrsn
  addtlAttrbts : AddtlAttrbts
    deriving (Eq, Ord, Show)

data Nm = Nm with 
  refRate : RefRate
  term : Term
    deriving (Eq, Ord, Show)

-- | Specifies a quantity as a non-negative number, which
--   condition is enforced through a data rule that only
--   applies to the extending class.
data NonNegativeQuantity = NonNegativeQuantity with 
  value : Optional Decimal
    -- ^ Specifies the value of the measure as a number.
    --   Optional because in a measure vector or schedule,
    --   this single value may be omitted.
  unit : Optional UnitType
    -- ^ Qualifies the unit by which the amount is measured.
    --   Optional because a measure may be unit-less (e.g.
    --   when representing a ratio between amounts in the same
    --   unit).
  datedValue : [DatedValue]
    -- ^ A schedule of step date and value pairs. On each step
    --   date the associated step value becomes effective. The
    --   step dates are used to order the steps by ascending
    --   order. This attribute is optional so the data type
    --   may be used to define a schedule with a single value.
  multiplier : Optional Measure
    -- ^ Defines an optional number that the quantity should
    --   be multiplied by to derive a total quantity. This
    --   number is associated to a unit. For example in the
    --   case of the Coal (API2) CIF ARA (ARGUS-McCloskey)
    --   Futures Contract on the CME, where the unit would be
    --   contracts, the multiplier value would 1,000 and the
    --   mulitiplier unit would be 1,000 MT (Metric Tons).
  frequency : Optional Frequency
    -- ^ Defines the frequency to be used when defining a
    --   quantity. For example a quantity may be specified as
    --   a number of barrels of oil per day, which needs
    --   multiplying by the number of days in the relevant
    --   period to get the total quantity as a number of
    --   barrels.
    deriving (Eq, Ord, Show)

data NonNegativeQuantitySchedule = NonNegativeQuantitySchedule with 
  value : Optional Decimal
    -- ^ Specifies the value of the measure as a number.
    --   Optional because in a measure vector or schedule,
    --   this single value may be omitted.
  unit : Optional UnitType
    -- ^ Qualifies the unit by which the amount is measured.
    --   Optional because a measure may be unit-less (e.g.
    --   when representing a ratio between amounts in the same
    --   unit).
  datedValue : [DatedValue]
    -- ^ A schedule of step date and value pairs. On each step
    --   date the associated step value becomes effective. The
    --   step dates are used to order the steps by ascending
    --   order. This attribute is optional so the data type
    --   may be used to define a schedule with a single value.
  multiplier : Optional Measure
    -- ^ Defines an optional number that the quantity should
    --   be multiplied by to derive a total quantity. This
    --   number is associated to a unit. For example in the
    --   case of the Coal (API2) CIF ARA (ARGUS-McCloskey)
    --   Futures Contract on the CME, where the unit would be
    --   contracts, the multiplier value would 1,000 and the
    --   mulitiplier unit would be 1,000 MT (Metric Tons).
  frequency : Optional Frequency
    -- ^ Defines the frequency to be used when defining a
    --   quantity. For example a quantity may be specified as
    --   a number of barrels of oil per day, which needs
    --   multiplying by the number of days in the relevant
    --   period to get the total quantity as a number of
    --   barrels.
    deriving (Eq, Ord, Show)

-- | A class defining a step date and non-negative step
--   value pair. This step definitions are used to define
--   varying rate or amount schedules, e.g. a notional
--   amortisation or a step-up coupon schedule.
data NonNegativeStep = NonNegativeStep with 
  stepDate : Date
    -- ^ The date on which the associated stepValue becomes
    --   effective. This day may be subject to adjustment in
    --   accordance with a business day convention.
  stepValue : Decimal
    -- ^ The non-negative rate or amount which becomes
    --   effective on the associated stepDate. A rate of 5%
    --   would be represented as 0.05.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A data type to specify the financial product's
--   economic terms, alongside the product identification
--   and product taxonomy. The non-transferable product
--   data type represents a product that can be traded (as
--   part of a TradableProduct) but cannot be transferred
--   to others.  It is meant to be used across the
--   pre-execution, execution and (as part of the
--   Contract) post-execution lifecycle contexts.
data NonTransferableProduct = NonTransferableProduct with 
  identifier : [ProductIdentifier]
    -- ^ Comprises a identifier and a source to uniquely
    --   identify the nonTransferableProduct. 
  taxonomy : [ProductTaxonomy]
    -- ^ Specifies the product taxonomy, which is composed of
    --   a taxonomy value and a taxonomy source.
  economicTerms : EconomicTerms
    -- ^ The price forming features, including payouts and
    --   provisions.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A class to specify the ISDA 2003 Term: Not Domestic
--   Currency.
data NotDomesticCurrency = NotDomesticCurrency with 
  applicable : Bool
    -- ^ Indicates whether the Not Domestic Currency provision
    --   is applicable.
  currency : Optional (FieldWithMeta Text)
    -- ^ An explicit specification of the domestic currency.
    --   The list of valid currencies is not presently
    --   positioned as an enumeration as part of the CDM
    --   because that scope is limited to the values specified
    --   by ISDA and FpML. As a result, implementers have to
    --   make reference to the relevant standard, such as the
    --   ISO 4217 standard for currency codes.
    deriving (Eq, Ord, Show)

-- | The number bound is defined as a number and whether
--   the bound is inclusive.
data NumberBound = NumberBound with 
  number : Decimal
    -- ^ The number to be used as the bound, e.g. 5.
  inclusive : Bool
    -- ^ Whether the number bound is inclusive, e.g. for a
    --   lower bound, false would indicate greater than,
    --   whereas true would indicate greater than or equal to.
    deriving (Eq, Ord, Show)

-- | The number range defined as either a lower and upper
--   number bound, or both.
data NumberRange = NumberRange with 
  lowerBound : Optional NumberBound
    -- ^ The lower bound of a number range, e.g. greater than
    --   or equal to 5.
  upperBound : Optional NumberBound
    -- ^ The upper bound of a number range, e.g. less than 10.
    deriving (Eq, Ord, Show)

-- | A class to specify the underlying obligations of the
--   reference entity on which protection is purchased or
--   sold through the Credit Default Swap.
data Obligations = Obligations with 
  category : ObligationCategoryEnum
    -- ^ Used in both obligations and deliverable obligations
    --   to represent a class or type of securities which
    --   apply. ISDA 2003 Term: Obligation
    --   Category/Deliverable Obligation Category.
  notSubordinated : Optional Bool
    -- ^ An obligation and deliverable obligation
    --   characteristic. An obligation that ranks at least
    --   equal with the most senior Reference Obligation in
    --   priority of payment or, if no Reference Obligation is
    --   specified in the related Confirmation, the
    --   obligations of the Reference Entity that are senior.
    --   ISDA 2003 Term: Not Subordinated.
  specifiedCurrency : Optional SpecifiedCurrency
    -- ^ An obligation and deliverable obligation
    --   characteristic. The currency or currencies in which
    --   an obligation or deliverable obligation must be
    --   payable. ISDA 2003 Term: Specified Currency.
  notSovereignLender : Optional Bool
    -- ^ An obligation and deliverable obligation
    --   characteristic. Any obligation that is not primarily
    --   (majority) owed to a Sovereign or Supranational
    --   Organisation. ISDA 2003 Term: Not Sovereign Lender.
  notDomesticCurrency : Optional NotDomesticCurrency
    -- ^ An obligation and deliverable obligation
    --   characteristic. Any obligation that is payable in any
    --   currency other than the domestic currency. Domestic
    --   currency is either the currency so specified or, if
    --   no currency is specified, the currency of (a) the
    --   reference entity, if the reference entity is a
    --   sovereign, or (b) the jurisdiction in which the
    --   relevant reference entity is organised, if the
    --   reference entity is not a sovereign. ISDA 2003 Term:
    --   Not Domestic Currency.
  notDomesticLaw : Optional Bool
    -- ^ An obligation and deliverable obligation
    --   characteristic. If the reference entity is a
    --   Sovereign, this means any obligation that is not
    --   subject to the laws of the reference entity. If the
    --   reference entity is not a sovereign, this means any
    --   obligation that is not subject to the laws of the
    --   jurisdiction of the reference entity. ISDA 2003 Term:
    --   Not Domestic Law.
  listed : Optional Bool
    -- ^ An obligation and deliverable obligation
    --   characteristic. Indicates whether or not the
    --   obligation is quoted, listed or ordinarily purchased
    --   and sold on an exchange. ISDA 2003 Term: Listed.
  notDomesticIssuance : Optional Bool
    -- ^ An obligation and deliverable obligation
    --   characteristic. Any obligation other than an
    --   obligation that was intended to be offered for sale
    --   primarily in the domestic market of the relevant
    --   Reference Entity. This specifies that the obligation
    --   must be an internationally recognised bond. ISDA 2003
    --   Term: Not Domestic Issuance.
  fullFaithAndCreditObLiability : Optional Bool
    -- ^ An obligation and deliverable obligation
    --   characteristic. Defined in the ISDA published
    --   additional provisions for U.S. Municipal as Reference
    --   Entity. ISDA 2003 Term: Full Faith and Credit
    --   Obligation Liability.
  generalFundObligationLiability : Optional Bool
    -- ^ An obligation and deliverable obligation
    --   characteristic. Defined in the ISDA published
    --   additional provisions for U.S. Municipal as Reference
    --   Entity. ISDA 2003 Term: General Fund Obligation
    --   Liability.
  revenueObligationLiability : Optional Bool
    -- ^ An obligation and deliverable obligation
    --   characteristic. Defined in the ISDA published
    --   additional provisions for U.S. Municipal as Reference
    --   Entity. ISDA 2003 Term: Revenue Obligation Liability.
  notContingent : Optional Bool
    -- ^ OTE: Only allowed as an obligation characteristic
    --   under ISDA Credit 1999. In essence Not Contingent
    --   means the repayment of principal cannot be dependent
    --   on a formula/index, i.e. to prevent the risk of being
    --   delivered an instrument that may never pay any
    --   element of principal, and to ensure that the
    --   obligation is interest bearing (on a regular
    --   schedule). ISDA 2003 Term: Not Contingent.
  excluded : Optional Text
    -- ^ A free format string to specify any excluded
    --   obligations or deliverable obligations, as the case
    --   may be, of the reference entity or excluded types of
    --   obligations or deliverable obligations. ISDA 2003
    --   Term: Excluded Obligations/Excluded Deliverable
    --   Obligations.
  othReferenceEntityObligations : Optional Text
    -- ^ This element is used to specify any other obligations
    --   of a reference entity in both obligations and
    --   deliverable obligations. The obligations can be
    --   specified free-form. ISDA 2003 Term: Other
    --   Obligations of a Reference Entity.
  designatedPriority : Optional (FieldWithMeta Text)
    -- ^ Applies to Loan CDS, to indicate what lien level is
    --   appropriate for a deliverable obligation. Applies to
    --   European Loan CDS, to indicate the Ranking of the
    --   obligation. Example: a 2nd lien Loan CDS would imply
    --   that the deliverable obligations are 1st or 2nd lien
    --   loans.
  cashSettlementOnly : Optional Bool
    -- ^ An obligation and deliverable obligation
    --   characteristic. Defined in the ISDA published
    --   Standard Terms Supplement for use with CDS
    --   Transactions on Leveraged Loans. ISDA 2003 Term: Cash
    --   Settlement Only.
  deliveryOfCommitments : Optional Bool
    -- ^ An obligation and deliverable obligation
    --   characteristic. Defined in the ISDA published
    --   Standard Terms Supplement for use with CDS
    --   Transactions on Leveraged Loans. ISDA 2003 Term:
    --   Delivery of Commitments.
  continuity : Optional Bool
    -- ^ An obligation and deliverable obligation
    --   characteristic. Defined in the ISDA published
    --   Standard Terms Supplement for use with CDS
    --   Transactions on Leveraged Loans. ISDA 2003 Term:
    --   Continuity.
    deriving (Eq, Ord, Show)

-- | Specifies the object to be observed for a price, it
--   could be an asset or a reference.
data Observable = Observable with 
  asset : Optional Asset
    -- ^ The object to be observed is an Asset, ie something
    --   that can be owned and transferred in the financial
    --   markets.
  basket : Optional Basket
    -- ^ The object to be observed is a Basket, ie a
    --   collection of Observables with an identifier and
    --   optional weightings.
  index : Optional Index
    -- ^ The object to be observed is an Index, ie an
    --   observable computed on the prices, rates or
    --   valuations of a number of assets.
    deriving (Eq, Ord, Show)

-- | Defines a single, numerical value that was observed
--   in the marketplace. Observations of market data are
--   made independently to business events or trade
--   life-cycle events, so data instances of Observation
--   can be created independently of any other model type,
--   hence it is annotated as a root type. Observations
--   will be broadly reused in many situations, so
--   references to Observation are supported via the
--   'key' annotation.
data Observation = Observation with 
  observedValue : Price
    -- ^ Specifies the observed value as a number.
  observationIdentifier : ObservationIdentifier
    -- ^ Represents the observation was made i.e. how to
    --   uniquely identify the observed value among the
    --   population of all available market data.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | Specifies a single date on which market observations
--   take place and specifies optional associated
--   weighting.
data ObservationDate = ObservationDate with 
  unadjustedDate : Optional Date
    -- ^ A date subject to adjustment.
  adjustedDate : Optional Date
    -- ^ The date once the adjustment has been performed.
    --   (Note that this date may change if the business
    --   center holidays change).
  weight : Optional Decimal
    -- ^ Specifies the degree of importance of the
    --   observation.
  observationReference : Optional Text
    -- ^ Specifies an identification key for the market
    --   observation. This attribute can be used as a
    --   reference to assign weights to a series of dates
    --   defined in a parametricSchedule.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | Describes date details for a set of observation dates
--   in parametric or non-parametric form.
data ObservationDates = ObservationDates with 
  observationSchedule : Optional ObservationSchedule
    -- ^ Specifies a schedule of dates (non-parametric) on
    --   which market observations take place, and allows for
    --   the optional definition of weights where applicable. 
    --   When no weight is specified, then weight of each date
    --   is assumed to be 1.0
  periodicSchedule : Optional PeriodicDates
    -- ^ Specifies the date range and frequency on which
    --   market observations take place.  Weights can be
    --   assigned to dates in the schedule by assigning the
    --   weight and corresponding observationReference in the
    --   observationSchedule.
  parametricDates : Optional ParametricDates
    -- ^ Specifies parametric terms to determine which days
    --   within a given calculation period the price would be
    --   observed. Typically associated with Commodities. 
    deriving (Eq, Ord, Show)

-- | Specifies the necessary information to create any
--   observation event.
data ObservationEvent = ObservationEvent with 
  creditEvent : Optional CreditEvent
    -- ^ Specifies the necessary information to create a
    --   credit event.
  corporateAction : Optional CorporateAction
    -- ^ Specifies the necessary information to create a
    --   corporate action.
    deriving (Eq, Ord, Show)

-- | Defines the parameters needed to uniquely identify a
--   piece of data among the population of all available
--   market data.
data ObservationIdentifier = ObservationIdentifier with 
  observable : Observable
    -- ^ Represents the asset or rate to which the observation
    --   relates.
  observationDate : Date
    -- ^ Specifies the date value to use when resolving the
    --   market data.
  observationTime : Optional TimeZone
    -- ^ Represents the time and time-zone.
  informationSource : Optional InformationSource
    -- ^ Represents where the market data published and should
    --   be observed.
  determinationMethodology : Optional DeterminationMethodology
    -- ^ Specifies the method according to which an amount or
    --   a date is determined.
    deriving (Eq, Ord, Show)

-- | Specifies inputs needed to process an observation.
data ObservationInstruction = ObservationInstruction with 
  observationEvent : ObservationEvent
    -- ^ Contains all information related to an observation.
    deriving (Eq, Ord, Show)

-- | Parameters on daily observed computed rates,
--   specifically daily caps and floors. This type is used
--   to represent modular computed rates in
--   interestRatePayouts.
data ObservationParameters = ObservationParameters with 
  observationCapRate : Optional Decimal
    -- ^ A daily observation cap rate.
  observationFloorRate : Optional Decimal
    -- ^ A daily observation floor rate.
    deriving (Eq, Ord, Show)

-- | Specifies a single date on which market observations
--   take place and specifies optional associated
--   weighting.
data ObservationSchedule = ObservationSchedule with 
  observationDate : [ObservationDate]
    -- ^ Specifies an adjusted or unadjusted date for a market
    --   observation.
  dateAdjustments : Optional BusinessDayAdjustments
    -- ^ The business day convention and financial business
    --   centers used for adjusting the date if it would
    --   otherwise fall on a day that is not a business date
    --   in the specified business centers.
    deriving (Eq, Ord, Show)

-- | Parameters to describe the observation shift for a
--   daily compounded or averaged floating rate. This type
--   is used to represent modular computed rates in
--   interestRatePayouts.
data ObservationShiftCalculation = ObservationShiftCalculation with 
  offsetDays : Optional Int
    -- ^ The number of days of observation shift.
  calculationBase : Optional ObservationPeriodDatesEnum
    -- ^ Whether the rate is calculated in advance, in
    --   arrears, or relative to a reset date.
  additionalBusinessDays : Optional BusinessCenters
    -- ^ Any additional business days that be applicable.
    deriving (Eq, Ord, Show)

-- | Class containing terms that are associated with
--   observing a price/benchmark/index across either
--   single or multiple observations. 
data ObservationTerms = ObservationTerms with 
  observationTime : Optional BusinessCenterTime
    -- ^ Defines time in respect to a business calendar
    --   location that the price/benchmark/index is observed
  observationTimeType : Optional TimeTypeEnum
    -- ^ The enumerated values to specify points in the day
    --   when option exercise and valuation can occur.
  informationSource : Optional FxSpotRateSource
    -- ^ The information source where a published or displayed
    --   market rate will be obtained, e.g. Telerate Page
    --   3750.
  precision : Optional Rounding
    -- ^ Defines rounding rules and precision to be used in
    --   the rounding of observations.
  calculationPeriodDates : Optional CalculationPeriodDates
    -- ^ Defines parameters used to generate the calculation
    --   period dates schedule, including the specification of
    --   any initial or final stub calculation periods. A
    --   calculation period schedule consists of an optional
    --   initial stub calculation period, one or more regular
    --   calculation periods and an optional final stub
    --   calculation period. In the absence of any initial or
    --   final stub calculation periods, the regular part of
    --   the calculation period schedule is assumed to be
    --   between the effective date and the termination date.
    --   No implicit stubs are allowed, i.e. stubs must be
    --   explicitly specified using an appropriate combination
    --   of firstPeriodStartDate, firstRegularPeriodStartDate
    --   and lastRegularPeriodEndDate.
  observationDates : ObservationDates
    -- ^ Describes date details for a set of observation dates
    --   in parametric or non-parametric form.
  numberOfObservationDates : Optional Int
    -- ^ The number of observation dates between observation
    --   start date and observation end date.
    deriving (Eq, Ord, Show)

-- | A class defining an offset used in calculating a new
--   date relative to a reference date, e.g. calendar
--   days, business days, commodity Business days, etc.
data Offset = Offset with 
  periodMultiplier : Int
    -- ^ A time period multiplier, e.g. 1, 2 or 3 etc. A
    --   negative value can be used when specifying an offset
    --   relative to another date, e.g. -2 days.
  period : PeriodEnum
    -- ^ A time period, e.g. a day, week, month or year of the
    --   stream. If the periodMultiplier value is 0 (zero)
    --   then period must contain the value D (day).
  meta : Optional MetaFields
  dayType : Optional DayTypeEnum
    -- ^ In the case of an offset specified as a number of
    --   days, this element defines whether consideration is
    --   given as to whether a day is a good business day or
    --   not. If a day type of business days is specified then
    --   non-business days are ignored when calculating the
    --   offset. The financial business centers to use for
    --   determination of business days are implied by the
    --   context in which this element is used. This element
    --   must only be included when the offset is specified as
    --   a number of days. If the offset is zero days then the
    --   dayType element should not be included.
    deriving (Eq, Ord, Show)

-- | Defines business day shifts for daily componded or
--   averaged rates.  This type is used for lookback and
--   lockout rates. This type is used to represent modular
--   computed rates in interestRatePayouts.
data OffsetCalculation = OffsetCalculation with 
  offsetDays : Optional Int
    -- ^ The number of business days offset.
    deriving (Eq, Ord, Show)

-- | Defines additional optional features that can be
--   included in an option contract.
data OptionFeature = OptionFeature with 
  fxFeature : [FxFeature]
    -- ^ Describes a quanto or composite FX feature.
  strategyFeature : Optional StrategyFeature
    -- ^ Defines a simple strategy feature.
  averagingFeature : Optional AveragingCalculation
    -- ^ Defines an option feature in which an average market
    --   observation price is determined on valuation and
    --   compared to the strike to determine a settlement
    --   amount.
  barrier : Optional Barrier
    -- ^ Specifies a barrier feature.
  knock : Optional Knock
    -- ^ Specifies a knock in or knock out feature.
  passThrough : Optional PassThrough
    -- ^ Specifies the rules for pass-through payments from
    --   the underlier, such as dividends.
    deriving (Eq, Ord, Show)

-- | The option payout specification terms. The associated
--   globalKey denotes the ability to associate a hash
--   value to the respective OptionPayout instantiation
--   for the purpose of model cross-referencing, in
--   support of functionality such as the event effect and
--   the lineage.
data OptionPayout = OptionPayout with 
  payerReceiver : PayerReceiver
    -- ^ Canonical representation of the payer and receiver
    --   parties applicable to each payout leg.
  priceQuantity : Optional ResolvablePriceQuantity
    -- ^ Each payout leg must implement the quantity concept
    --   as a 'resolvable' type, which allows for
    --   different payout legs to be linked to each other
    --   (e.g. in the case of cross-curreny products).
  principalPayment : Optional PrincipalPayments
    -- ^ The specification of the principal exchange. Optional
    --   as only applicable in the case of cross-currency or
    --   zero-coupon swaps with a final payment.
  settlementTerms : Optional SettlementTerms
    -- ^ Each payout leg must specifies its settlement terms,
    --   including the delivery type (i.e. cash vs physical,
    --   and their respective terms), the transfer type (DvP
    --   etc.) and settlement date, if any.
  buyerSeller : BuyerSeller
  feature : Optional OptionFeature
    -- ^ The option feature, such as quanto, Asian, barrier,
    --   knock.
  observationTerms : Optional ObservationTerms
    -- ^ Class containing terms that are associated with
    --   observing a price/benchmark/index across either
    --   single or multple observations. To be used for option
    --   contracts that reference a benchmark price.
  schedule : Optional CalculationSchedule
    -- ^ Allows the full representation of a payout by
    --   defining a set of schedule periods. It supports
    --   standard schedule customization by expressing all the
    --   dates, quantities, and pricing data in a
    --   non-parametric way.
  delivery : Optional AssetDeliveryInformation
    -- ^ Contains the information relative to the delivery of
    --   the asset.
  underlier : Underlier
    -- ^ The financial product underlying the option, which
    --   can be of any type including an Asset, Basket, Index
    --   or a NonTransferableProduct.
  optionType : Optional OptionTypeEnum
    -- ^ The type of option transaction. From a usage
    --   standpoint, put/call is the default option type,
    --   while payer/receiver indicator is used for options on
    --   index credit default swaps, consistently with the
    --   industry practice. Straddle is used for the case of
    --   straddle strategy, that combine a call and a put with
    --   the same strike.
  exerciseTerms : ExerciseTerms
    -- ^ The terms for exercising the option, which include
    --   the option style (e.g. American style option), the
    --   exercise procedure (e.g. manual exercise) and the
    --   settlement terms (e.g. physical vs. cash).
  strike : Optional OptionStrike
    -- ^ Specifies the strike of the option
  fixedPrice : [ReferenceWithMeta PriceSchedule]
    -- ^ Specifies the price of the settlement. The multiple
    --   cardinality is aligned to the one of the
    --   PriceQuantity->price that this price is
    --   referencing.
    deriving (Eq, Ord, Show)

-- | Defines the strike price of an option.
data OptionStrike = OptionStrike with 
  strikePrice : Optional Price
    -- ^ Defines the strike of an option in the form of a
    --   price that could be a cash price, interestRate, or
    --   other types.
  strikeReference : Optional (ReferenceWithMeta FixedRateSpecification)
    -- ^ Defines the strike of an option in reference to the
    --   spread of the underlying swap (typical practice in
    --   the case of an option on a credit single name swaps).
  referenceSwapCurve : Optional ReferenceSwapCurve
    -- ^ Defines the strike of an option when expressed by
    --   reference to a swap curve (Typically the case for a
    --   convertible bond option).
  averagingStrikeFeature : Optional AveragingStrikeFeature
    -- ^ Defines an  option strike that is calculated from an
    --   average of observed market prices.
    deriving (Eq, Ord, Show)

-- | A data defining:  an early termination provision
--   where either or both parties have the right to
--   exercise.
data OptionalEarlyTermination = OptionalEarlyTermination with 
  singlePartyOption : Optional BuyerSeller
    -- ^ If optional early termination is not available to
    --   both parties then this component specifies the buyer
    --   and seller of the option. In FpML, this attribute is
    --   of type SinglePsrtyOption, which actually consists of
    --   the BuyerSeller.model.
  mutualEarlyTermination : Optional Bool
    -- ^ Used for specifying whether the Mutual Early
    --   Termination Right that is detailed in the Master
    --   Confirmation will apply.
  exerciseNotice : [ExerciseNotice]
    -- ^ Definition of the party to whom notice of exercise
    --   should be given.
  followUpConfirmation : Optional Bool
    -- ^ A flag to indicate whether follow-up confirmation of
    --   exercise (written or electronic) is required
    --   following telephonic notice by the buyer to the
    --   seller or seller's agent.
  calculationAgent : Optional CalculationAgent
    -- ^ The ISDA Calculation Agent responsible for performing
    --   duties associated with an optional early termination.
  cashSettlement : Optional SettlementTerms
    -- ^ If specified, this means that cash settlement is
    --   applicable to the transaction and defines the
    --   parameters associated with the cash settlement
    --   procedure. If not specified, then physical settlement
    --   is applicable.
  optionalEarlyTerminationAdjustedDates : Optional OptionalEarlyTerminationAdjustedDates
    -- ^ An early termination provision to terminate the trade
    --   at fair value where one or both parties have the
    --   right to decide on termination.
  exerciseTerms : ExerciseTerms
    -- ^ The exercise terms associated with the optional early
    --   termination, including details such as exercise
    --   style, exercise fees, and any other relevant
    --   conditions or terms.
    deriving (Eq, Ord, Show)

-- | A data defining:  the adjusted dates associated with
--   an optional early termination provision.
data OptionalEarlyTerminationAdjustedDates = OptionalEarlyTerminationAdjustedDates with 
  earlyTerminationEvent : [EarlyTerminationEvent]
    -- ^ The adjusted dates associated with an individual
    --   early termination date.
    deriving (Eq, Ord, Show)

data OrdrTrnsmssn = OrdrTrnsmssn with 
  trnsmssnInd : Text
    deriving (Eq, Ord, Show)

-- | A class for defining an agreement executed between
--   parties.
data OtherAgreement = OtherAgreement with 
  identifier : Optional (FieldWithMeta Text)
    -- ^ An identifier that has been created to identify the
    --   agreement.
  otherAgreementType : (FieldWithMeta Text)
    -- ^ The agreement executed between the parties and
    --   intended to govern product-specific derivatives
    --   transactions between those parties.
  version : Optional (FieldWithMeta Text)
    -- ^ The version of the agreement.
  date : Optional Date
    -- ^ The date on which the agreement was signed.
    deriving (Eq, Ord, Show)

-- | A class to specify a related legal agreement. For
--   example, ISDA 2016 Credit Support Annex for Initial
--   Margin, paragraph 13, General Principles, (s): Other
--   CSA and Japanese Law CSA (VM). | ISDA 2016 Credit
--   Support Annex for Variation Margin, paragraph 13,
--   (o): Other CSA.
data OtherAgreementTerms = OtherAgreementTerms with 
  isSpecified : Bool
    -- ^ The qualification of whether some other related
    --   agreement is specified (True) or not (False).
  legalDocument : Optional Text
    -- ^ The specification of this other agreement, when the
    --   qualification is True.
    deriving (Eq, Ord, Show)

-- | Specification of a user-defined index that does not
--   meet the criteria of other Index data types.
data OtherIndex = OtherIndex with 
  identifier : [AssetIdentifier]
    -- ^ Asset Identifiers are used to uniquely identify an
    --   Asset, using a specified Asset Identifier Type.
  taxonomy : [Taxonomy]
    -- ^ Defines the taxonomy of an object by combining a
    --   taxonomy source (i.e. the rules to classify the
    --   object) and a value (i.e. the output of those rules
    --   on the object.
  isExchangeListed : Optional Bool
    -- ^ Defines whether the Asset is listed on a public
    --   exchange.
  exchange : Optional LegalEntity
    -- ^ If the Asset is listed, defines the public exchange
    --   of the listing.
  relatedExchange : [LegalEntity]
    -- ^ Provides the related Exchanges, if applicable.
  name : Optional (FieldWithMeta Text)
    -- ^ A description of the Index.
  provider : Optional LegalEntity
    -- ^ The organisation that creates or maintains the Index.
  assetClass : Optional AssetClassEnum
    -- ^ The Asset Class of the Index.
  description : Optional Text
    -- ^ A description that defines the OtherIndex.
    deriving (Eq, Ord, Show)

data Othr = Othr with 
  finInstrmGnlAttrbts : FinInstrmGnlAttrbts
  derivInstrmAttrbts : DerivInstrmAttrbts
  id : Text
  schmeNm : SchmeNm
    deriving (Eq, Ord, Show)

-- | A class to specify the Partial Cash Deliverable
--   Obligation Characteristic.
data PCDeliverableObligationCharac = PCDeliverableObligationCharac with 
  applicable : Bool
    -- ^ Indicates whether the provision is applicable.
  partialCashSettlement : Optional Bool
    -- ^ Specifies whether either 'Partial Cash Settlement
    --   of Assignable Loans', 'Partial Cash
    --   Settlement of Consent Required Loans' or
    --   'Partial Cash Settlement of Participations'
    --   is applicable. If this element is specified and
    --   Assignable Loan is a Deliverable Obligation
    --   Characteristic, any Assignable Loan that is
    --   deliverable, but where a non-receipt of Consent by
    --   the Physical Settlement Date has occurred, the Loan
    --   can be cash settled rather than physically delivered.
    --   If this element is specified and Consent Required
    --   Loan is a Deliverable Obligation Characteristic, any
    --   Consent Required Loan that is deliverable, but where
    --   a non-receipt of Consent by the Physical Settlement
    --   Date has occurred, the Loan can be cash settled
    --   rather than physically delivered. If this element is
    --   specified and Direct Loan Participation is a
    --   Deliverable Obligation Characteristic, any
    --   Participation that is deliverable, but where this
    --   participation has not been effected (has not come
    --   into effect) by the Physical Settlement Date, the
    --   participation can be cash settled rather than
    --   physically delivered.
    deriving (Eq, Ord, Show)

-- | Defines rules for the dates on which the price will
--   be determined.
data ParametricDates = ParametricDates with 
  dayType : DayTypeEnum
    -- ^ Denotes the enumerated values to specify the day type
    --   classification used in counting the number of days
    --   between two dates.
  dayDistribution : Optional DayDistributionEnum
    -- ^ Denotes the method by which the pricing days are
    --   distributed across the pricing period.
  dayOfWeek : [DayOfWeekEnum]
    -- ^ Indicates the days of the week on which the price
    --   will be determined.
  dayFrequency : Optional Decimal
    -- ^ Defines the occurrence of the dayOfWeek within the
    --   pricing period on which pricing will take place, e.g.
    --   the 3rd Friday within each Calculation Period. If
    --   omitted, every dayOfWeek will be a pricing day.
  lag : Optional Lag
    -- ^ The pricing period per calculation period if the
    --   pricing days do not wholly fall within the respective
    --   calculation period.
  businessCenters : BusinessCenters
    -- ^ The enumerated values to specify the business
    --   centers.
    deriving (Eq, Ord, Show)

-- | A class defining partial exercise. As defined in the
--   2000 ISDA Definitions, Section 12.3 Partial Exercise,
--   the buyer of the option may exercise all or less than
--   all the notional amount of the underlying swap but
--   may not be less than the minimum notional amount (if
--   specified) and must be an integral multiple of the
--   integral multiple amount if specified.
data PartialExercise = PartialExercise with 
  notionaReference : (ReferenceWithMeta Money)
    -- ^ A pointer style reference to the associated notional
    --   schedule defined elsewhere in the document. This
    --   element has been made optional as part of its
    --   integration in the OptionBaseExtended, because not
    --   required for the options on securities.
  integralMultipleAmount : Optional Decimal
    -- ^ A notional amount which restricts the amount of
    --   notional that can be exercised when partial exercise
    --   or multiple exercise is applicable. The integral
    --   multiple amount defines a lower limit of notional
    --   that can be exercised and also defines a unit
    --   multiple of notional that can be exercised, i.e. only
    --   integer multiples of this amount can be exercised.
  minimumNotionalAmount : Optional Decimal
    -- ^ The minimum notional amount that can be exercised on
    --   a given exercise date. See multipleExercise.
  minimumNumberOfOptions : Optional Int
    -- ^ The minimum number of options that can be exercised
    --   on a given exercise date.
    deriving (Eq, Ord, Show)

-- | A class to specify a party, without a qualification
--   as to whether this party is a legal entity or a
--   natural person, although the model provides the
--   ability to associate a person (or set of persons) to
--   a party, which use case would imply that such party
--   would be a legal entity (even if not formally
--   specified as such). 
data Party = Party with 
  partyId : [PartyIdentifier]
    -- ^ The identifier associated with a party, e.g. the 20
    --   digits LEI code.
  name : Optional (FieldWithMeta Text)
    -- ^ The party name.
  businessUnit : [BusinessUnit]
    -- ^ Optional organization unit information used to
    --   describe the organization units (e.g. trading desks)
    --   involved in a transaction or business process, incl.
    --   the contact information (when relevant).
  person : [NaturalPerson]
    -- ^ The person(s) who might be associated with the party
    --   as part of the execution, contract or legal document.
  personRole : [NaturalPersonRole]
    -- ^ The role of the person(s) 
  account : Optional Account
    -- ^ The account that might be associated with the party.
    --   At most one account can be specified, as it is
    --   expected that this information is used in the context
    --   of a contract or legal document where only one
    --   account per party can be associated with such object.
  contactInformation : Optional ContactInformation
    -- ^ The postal/street address, telephone number, email
    --   address and/or web page. If the contact information
    --   is specific to the associated business unit(s) or
    --   person (s), it should be associated with those.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | Specifies instruction to change the party on a trade.
--   This primitive instruction is used in a number of
--   scenarios including: clearing, allocation and
--   novation. The instrution must include a trade
--   identifier, because a change of party effectively
--   results in a different trade.
data PartyChangeInstruction = PartyChangeInstruction with 
  counterparty : Counterparty
    -- ^ The new counterparty who is stepping into the trade.
    --   The stepping out counterparty is inferred based on
    --   the counterparty role that is being updated.
  ancillaryParty : Optional AncillaryParty
    -- ^ Specifies an ancillary party to be added onto the new
    --   transaction, e.g. the original executing party in an
    --   allocation.
  partyRole : Optional PartyRole
    -- ^ Specifies an additional party roles to be added on to
    --   the new transaction.
  tradeId : [TradeIdentifier]
    -- ^ The identifier to be assigned to the new trade post
    --   change of party.
    deriving (Eq, Ord, Show)

-- | A class to specify contact information within a
--   party: address and, optionally, associated business
--   unit and person. This class also supports the ISDA
--   CSA representation as a single string, through the
--   address attribute.
data PartyContactInformation = PartyContactInformation with 
  partyReference : Optional (ReferenceWithMeta Party)
    -- ^ The reference to the party to which the contact
    --   information refers to.
  contactInformation : Optional ContactInformation
    -- ^ The postal/street address, telephone number, email
    --   address and/or web page. If the contact information
    --   is specific to the associated business unit(s), it
    --   should be associated with those.
  businessUnit : [BusinessUnit]
    -- ^ Optional organization unit information used to
    --   describe the organization units (e.g. trading desks)
    --   involved in a transaction or business process, incl.
    --   the contact information (when relevant).
  person : [NaturalPerson]
    -- ^ Optional information about people involved in a
    --   transaction or business process. (These are employees
    --   of the party.)
  additionalInformation : Optional Text
    -- ^ Specification of special instructions of the relevant
    --   party.
    deriving (Eq, Ord, Show)

-- | A class to specify a party-related, non-standardized
--   data in a generic form.
data PartyCustomisedWorkflow = PartyCustomisedWorkflow with 
  partyReference : Optional (ReferenceWithMeta Party)
    -- ^ Reference to the party to which the workflow pertains
    --   to.
  partyName : Optional Text
    -- ^ The party name to which the workflow pertains to.
  customisedWorkflow : [CustomisedWorkflow]
    -- ^ Non-standardized data in a generic form.
    deriving (Eq, Ord, Show)

-- | Comprises an identifier and a source. The associated
--   metadata key denotes the ability to associate a hash
--   value to the PartyIdentifier instantiations for the
--   purpose of model cross-referencing, in support of
--   functionality such as the event effect and the
--   lineage.
data PartyIdentifier = PartyIdentifier with 
  identifier : (FieldWithMeta Text)
    -- ^ Provides an identifier associated with a party. The
    --   identifier is unique within the public source
    --   specified in the source attribute.
  identifierType : Optional PartyIdentifierTypeEnum
    -- ^ Defines the source of the identifier.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | Specifies the parties responsible for making and
--   receiving payments defined by this structure.
data PartyReferencePayerReceiver = PartyReferencePayerReceiver with 
  payerPartyReference : (ReferenceWithMeta Party)
    -- ^ The party responsible for making the payments defined
    --   by this structure.
  payerAccountReference : Optional (ReferenceWithMeta Account)
    -- ^ A reference to the account responsible for making the
    --   payments defined by this structure.
  receiverPartyReference : (ReferenceWithMeta Party)
    -- ^ The party that receives the payments corresponding to
    --   this structure.
  receiverAccountReference : Optional (ReferenceWithMeta Account)
    -- ^ A reference to the account that receives the payments
    --   corresponding to this structure.
    deriving (Eq, Ord, Show)

-- | A class to specify the role(s) that party(ies) may
--   have in relation to the execution, contract or other
--   legal agreement.
data PartyRole = PartyRole with 
  partyReference : (ReferenceWithMeta Party)
    -- ^ A reference to the party to which the role refers to.
  role : PartyRoleEnum
    -- ^ The party role.
  ownershipPartyReference : Optional (ReferenceWithMeta Party)
    -- ^ A reference to the party that has ownership of this
    --   party role information. FpML specifies that For
    --   shared trade information, this attribute will
    --   reference the originator of the data (for example, an
    --   execution facility or clearing house).
    deriving (Eq, Ord, Show)

-- | Type which contains pass through payments.
data PassThrough = PassThrough with 
  passThroughItem : [PassThroughItem]
    -- ^ One to many pass through payment items.
    deriving (Eq, Ord, Show)

-- | Class to represent a single pass through payment.
data PassThroughItem = PassThroughItem with 
  payerReceiver : PayerReceiver
    -- ^ This attribute doesn't exists in the FpML
    --   construct, which makes use of the PayerReceiver.model
    --   group.
  passThroughPercentage : Decimal
    -- ^ Percentage of payments from the underlier which are
    --   passed through.
    deriving (Eq, Ord, Show)

-- | Specifies the parties responsible for making and
--   receiving payments defined by this structure.
data PayerReceiver = PayerReceiver with 
  payer : CounterpartyRoleEnum
    -- ^ Specifies the counterparty responsible for making the
    --   payments defined by this structure.  The party is one
    --   of the two principal parties to the transaction.
  receiver : CounterpartyRoleEnum
    -- ^ Specifies the party that receives the payments
    --   corresponding to this structure.  The party is one of
    --   the two counterparties to the transaction.
    deriving (Eq, Ord, Show)

-- | A data defining:  the adjusted payment date and
--   associated calculation period parameters required to
--   calculate the actual or projected payment amount.
--   This data forms:  part of the cashflow representation
--   of a swap stream.
data PaymentCalculationPeriod = PaymentCalculationPeriod with 
  unadjustedPaymentDate : Optional Date
    -- ^ The unadjusted payment date.
  adjustedPaymentDate : Optional Date
    -- ^ The adjusted payment date. This date should already
    --   be adjusted for any applicable business day
    --   convention. This component is not intended for use in
    --   trade confirmation but may be specified to allow the
    --   fee structure to also serve as a cashflow type
    --   component.
  calculationPeriod : [CalculationPeriod]
    -- ^ The parameters used in the calculation of a fixed or
    --   floating rate calculation period amount. A list of
    --   calculation period elements may be ordered in the
    --   document by ascending start date. An FpML document
    --   which contains an unordered list of calculation
    --   periods is still regarded as a conformant document.
  fixedPaymentAmount : Optional Money
    -- ^ A known fixed payment amount.
  discountFactor : Optional Decimal
    -- ^ A decimal value representing the discount factor used
    --   to calculate the present value of cash flow.
  forecastPaymentAmount : Optional Money
    -- ^ A monetary amount representing the forecast of the
    --   future value of the payment.
  presentValueAmount : Optional Money
    -- ^ A monetary amount representing the present value of
    --   the forecast payment.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | The payment dates when specified as relative to a set
--   of dates specified somewhere else in the instance
--   document/transaction, e.g. the valuation dates as
--   typically the case for equity swaps, or when
--   specified as a calculation period schedule.
data PaymentDateSchedule = PaymentDateSchedule with 
  interimPaymentDates : [AdjustableRelativeOrPeriodicDates]
  finalPaymentDate : Optional AdjustableOrRelativeDate
    -- ^ The last payment when specified as an adjustable or
    --   relative date, as in the FpML total return construct.
    deriving (Eq, Ord, Show)

-- | Specifies the parameters to generate the payment date
--   schedule, either through a parametric representation
--   or by reference to specified dates.
data PaymentDates = PaymentDates with 
  paymentFrequency : Optional Frequency
    -- ^ The frequency at which regular payment dates occur.
    --   If the payment frequency is equal to the frequency
    --   defined in the calculation period dates component
    --   then one calculation period contributes to each
    --   payment amount. If the payment frequency is less
    --   frequent than the frequency defined in the
    --   calculation period dates component then more than one
    --   calculation period will contribute to the payment
    --   amount. A payment frequency more frequent than the
    --   calculation period frequency or one that is not a
    --   multiple of the calculation period frequency is
    --   invalid. If the payment frequency is of value T
    --   (term), the period is defined by the effectiveDate
    --   and the terminationDate.
  firstPaymentDate : Optional Date
    -- ^ The first unadjusted payment date. This day may be
    --   subject to adjustment in accordance with any business
    --   day convention specified in paymentDatesAdjustments.
    --   This element must only be included if there is an
    --   initial stub. This date will normally correspond to
    --   an unadjusted calculation period start or end date.
    --   This is true even if early or delayed payment is
    --   specified to be applicable since the actual first
    --   payment date will be the specified number of days
    --   before or after the applicable adjusted calculation
    --   period start or end date with the resulting payment
    --   date then being adjusted in accordance with any
    --   business day convention specified in
    --   paymentDatesAdjustments.
  lastRegularPaymentDate : Optional Date
    -- ^ The last regular payment date when specified as a
    --   date, as in the FpML interest rate construct. FpML
    --   specifies that this date may be subject to adjustment
    --   in accordance with any business day convention
    --   specified in the paymentDatesAdjustments attribute.
  paymentDateSchedule : Optional PaymentDateSchedule
    -- ^ The payment dates when specified as relative to a set
    --   of dates specified somewhere else in the instance
    --   document/transaction, e.g. the valuation dates as
    --   typically the case for equity swaps, or when
    --   specified as a calculation period schedule.
  payRelativeTo : Optional PayRelativeToEnum
    -- ^ Specifies whether the payments occur relative to each
    --   adjusted calculation period start date or end date,
    --   each reset date, valuation date or the last pricing
    --   date. Calculation period start date means relative to
    --   the start of the first calculation period
    --   contributing to a given payment. Similarly,
    --   calculation period end date means the end of the last
    --   calculation period contributing to a given payment.
    --   The valuation date is applicable for Brazilian-CDI
    --   and equity swaps.
  paymentDaysOffset : Optional Offset
    -- ^ If early payment or delayed payment is required,
    --   specifies the number of days offset that the payment
    --   occurs relative to what would otherwise be the
    --   unadjusted payment date. The offset can be specified
    --   in terms of either calendar or business days. Even in
    --   the case of a calendar days offset, the resulting
    --   payment date, adjusted for the specified calendar
    --   days offset, will still be adjusted in accordance
    --   with the specified payment dates adjustments. This
    --   element should only be included if early or delayed
    --   payment is applicable, i.e. if the periodMultiplier
    --   element value is not equal to zero. An early payment
    --   would be indicated by a negative periodMultiplier
    --   element value and a delayed payment (or payment lag)
    --   would be indicated by a positive periodMultiplier
    --   element value.
  paymentDatesAdjustments : Optional BusinessDayAdjustments
    -- ^ The definition of the business day convention and
    --   financial business centers used for adjusting the
    --   payment date if it would otherwise fall on a day that
    --   is not a business day in the specified business
    --   center.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

data PaymentDetail = PaymentDetail with 
  paymentDate : Optional AdjustableOrRelativeDate
  paymentRule : PaymentRule
    -- ^ The calculation rule.
  paymentAmount : Optional Money
    -- ^ A fixed payment amount.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | This class corresponds to the FpML
--   PaymentDiscounting.model group for representing the
--   discounting elements that can be associated with a
--   payment.
data PaymentDiscounting = PaymentDiscounting with 
  discountFactor : Optional Decimal
    -- ^ The value representing the discount factor used to
    --   calculate the present value of the cash flow.
  presentValueAmount : Optional Money
    -- ^ The amount representing the present value of the
    --   forecast payment.
    deriving (Eq, Ord, Show)

-- | A class defining the payment calculation rule. As of
--   FpML 5.10, percentage rule is the only calculation
--   rule that has been specified as part of the standard.
data PaymentRule = PaymentRule with 
  percentageRule : Optional PercentageRule
    -- ^ This attribute is not present as part of the FpML
    --   construct, as the payment rule is specialised by
    --   means of runtime type extension through the xsi:type.
    deriving (Eq, Ord, Show)

-- | Represents the set of future cashflow methodologies
--   in the form of specific payout data type(s) which
--   result from the financial product.  Examples: a trade
--   in a cash asset will use only a settlement payout;
--   for derivatives, two interest rate payouts can be
--   combined to specify an interest rate swap; one
--   interest rate payout can be combined with a credit
--   default payout to specify a credit default swap.
data Payout = Payout with 
  assetPayout : Optional AssetPayout
    -- ^ Defines the assets and movements in a security
    --   financing transaction.
  cashflow : Optional Cashflow
    -- ^ A cashflow between the parties to the trade. For
    --   interest rate and equity products, this corresponds
    --   to the FpML additionalPayment element. For credit
    --   default swaps, this corresponds to the FpML
    --   initialPayment element and the singlePayment element
    --   of the fee leg. For option products, it represents
    --   the FpML premium element.
  commodityPayout : Optional CommodityPayout
    -- ^ Defines the payout for the floating leg of a
    --   Commodity Swap.
  creditDefaultPayout : Optional CreditDefaultPayout
    -- ^ The credit default payout, which provides the details
    --   necessary for determining when a credit payout will
    --   be triggered as well as the parameters for
    --   calculating the payout and the settlement terms.
  fixedPricePayout : Optional FixedPricePayout
    -- ^ Defines a payout in which one or more payouts are
    --   defined as a fixed price.
  interestRatePayout : Optional InterestRatePayout
    -- ^ All of the terms necessary to define and calculate a
    --   cash flow based on a fixed, a floating or an
    --   inflation index rate. The interest rate payout can be
    --   applied to interest rate swaps and FRA (which both
    --   have two associated interest rate payouts), credit
    --   default swaps (to represent the fee leg when subject
    --   to periodic payments) and equity swaps (to represent
    --   the funding leg).
  optionPayout : Optional OptionPayout
    -- ^ The option payout.
  performancePayout : Optional PerformancePayout
    -- ^ The performance payout, which encompasses the equity
    --   price returns, dividend returns, volatility return,
    --   variance return and correlation provisions.
  settlementPayout : Optional SettlementPayout
    -- ^ Represents a forward settling payout. The
    --   'Underlier' attribute captures the underlying
    --   payout, which is settled according to the
    --   'SettlementTerms' attribute. Both FX Spot and
    --   FX Forward should use this component.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A data type that contains the common attributes (e.g.
--   payer and receiver parties) and validation conditions
--   that apply across all payout types
data PayoutBase = PayoutBase with 
  payerReceiver : PayerReceiver
    -- ^ Canonical representation of the payer and receiver
    --   parties applicable to each payout leg.
  priceQuantity : Optional ResolvablePriceQuantity
    -- ^ Each payout leg must implement the quantity concept
    --   as a 'resolvable' type, which allows for
    --   different payout legs to be linked to each other
    --   (e.g. in the case of cross-curreny products).
  principalPayment : Optional PrincipalPayments
    -- ^ The specification of the principal exchange. Optional
    --   as only applicable in the case of cross-currency or
    --   zero-coupon swaps with a final payment.
  settlementTerms : Optional SettlementTerms
    -- ^ Each payout leg must specifies its settlement terms,
    --   including the delivery type (i.e. cash vs physical,
    --   and their respective terms), the transfer type (DvP
    --   etc.) and settlement date, if any.
    deriving (Eq, Ord, Show)

-- | A class defining a content model for a calculation
--   rule defined as percentage of the notional amount.
data PercentageRule = PercentageRule with 
  paymentPercent : Decimal
    -- ^ A percentage of the notional amount.
  notionalAmountReference : (ReferenceWithMeta Money)
    -- ^ A reference to the notional amount.
    deriving (Eq, Ord, Show)

-- | Contains the necessary specifications for all
--   performance payouts, encompassing equity return,
--   dividend, variance, volatility and correlation
--   products.
data PerformancePayout = PerformancePayout with 
  payerReceiver : PayerReceiver
    -- ^ Canonical representation of the payer and receiver
    --   parties applicable to each payout leg.
  priceQuantity : Optional ResolvablePriceQuantity
    -- ^ Each payout leg must implement the quantity concept
    --   as a 'resolvable' type, which allows for
    --   different payout legs to be linked to each other
    --   (e.g. in the case of cross-curreny products).
  principalPayment : Optional PrincipalPayments
    -- ^ The specification of the principal exchange. Optional
    --   as only applicable in the case of cross-currency or
    --   zero-coupon swaps with a final payment.
  settlementTerms : Optional SettlementTerms
    -- ^ Each payout leg must specifies its settlement terms,
    --   including the delivery type (i.e. cash vs physical,
    --   and their respective terms), the transfer type (DvP
    --   etc.) and settlement date, if any.
  observationTerms : Optional ObservationTerms
    -- ^ Defines how and when a performance type option or
    --   performance type swap is to be observed.
  valuationDates : ValuationDates
    -- ^ Defines how and when a performance type option or
    --   performance type swap is to be valued, including both
    --   interim and final valuation.
  paymentDates : PaymentDates
    -- ^ Defines the payment date schedule, as defined by the
    --   parameters that are needed to specify it, either in a
    --   parametric way or by reference to another schedule of
    --   dates (e.g. the valuation dates).
  underlier : Optional Underlier
    -- ^ Identifies the underlying product that is referenced
    --   for pricing of the applicable leg in a swap. 
    --   Referenced in the '2018 ISDA CDM Equity
    --   Confirmation for Security Equity Swap' as
    --   Security.
  fxFeature : [FxFeature]
    -- ^ Defines quanto or composite FX features that are
    --   included in the swap leg.
  returnTerms : Optional ReturnTerms
    -- ^ Specifies the type of return of a performance payout.
  portfolioReturnTerms : [PortfolioReturnTerms]
    -- ^ Specifies an individual type of return of a
    --   Performance Payout, when such individual return is
    --   part of an aggregation of multiple similar returns,
    --   at Performance Payout level
  initialValuationPrice : [ReferenceWithMeta PriceSchedule]
    -- ^ Specifies the net initial valuation price(s) of the
    --   underlier at Performance Payout level. This price can
    --   be expressed either as an actual amount/currency, as
    --   a determination method, or by reference to another
    --   value specified in the swap document.
  interimValuationPrice : [ReferenceWithMeta PriceSchedule]
    -- ^ Specifies the net initial valuation price(s) of the
    --   underlier at Performance Payout level. This price can
    --   be expressed either as an actual amount/currency, as
    --   a determination method, or by reference to another
    --   value specified in the swap document.
  finalValuationPrice : [ReferenceWithMeta PriceSchedule]
    -- ^ Specifies the net final valuation price(s) of the
    --   underlier at Performance Payout level. This price can
    --   be expressed either as an actual amount/currency, as
    --   a determination method, or by reference to another
    --   value specified in the swap document.
    deriving (Eq, Ord, Show)

-- | Defines how and when a performance type option or
--   performance type swap is to be valued.
data PerformanceValuationDates = PerformanceValuationDates with 
  determinationMethod : DeterminationMethodEnum
    -- ^ Specifies the method according to which an amount or
    --   a date is determined.
  valuationDates : Optional AdjustableRelativeOrPeriodicDates
    -- ^ 2018 ISDA CDM Equity Confirmation for Security Equity
    --   Swap: Pricing Date
  valuationDate : Optional AdjustableOrRelativeDate
    -- ^ 2018 ISDA CDM Equity Confirmation for Security Equity
    --   Swap: Pricing Date
  valuationTime : Optional BusinessCenterTime
    -- ^ The specific time of day at which the calculation
    --   agent values the underlying. The SpecificTime is the
    --   only case when the valuationTime (time + business
    --   center location  e.g. 10:00:00 USNY) should be
    --   provided. You should be able to provide just the
    --   valuationTime without valuationTimeType, which infer
    --   that this is a specific time.
  valuationTimeType : Optional TimeTypeEnum
    -- ^ The time of day at which the calculation agent values
    --   the underlying, for example the official closing time
    --   of the exchange.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A class to define recurring periods or time offsets.
data Period = Period with 
  periodMultiplier : Int
    -- ^ A time period multiplier, e.g. 1, 2 or 3 etc. A
    --   negative value can be used when specifying an offset
    --   relative to another date, e.g. -2 days.
  period : PeriodEnum
    -- ^ A time period, e.g. a day, week, month or year of the
    --   stream. If the periodMultiplier value is 0 (zero)
    --   then period must contain the value D (day).
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | Indicator to specify if the period bound is defined
--   as a period and whether the bound is inclusive.
data PeriodBound = PeriodBound with 
  period : Period
    -- ^ Specifies the period is to be used as the bound, e.g.
    --   5Y.
  inclusive : Bool
    -- ^ Specifies whether the period bound is inclusive, e.g.
    --   for a lower bound, false would indicate greater than,
    --   whereas true would indicate greater than or equal to.
    deriving (Eq, Ord, Show)

-- | Indicates The period range defined as either a lower
--   and upper period bound, or both.
data PeriodRange = PeriodRange with 
  lowerBound : Optional PeriodBound
    -- ^ Specifies the lower bound of a period range, e.g.
    --   greater than or equal to 5Y.
  upperBound : Optional PeriodBound
    -- ^ Specifies the upper bound of a period range, e.g.
    --   less than to 10Y.
    deriving (Eq, Ord, Show)

-- | A class for specifying a calculation period schedule.
data PeriodicDates = PeriodicDates with 
  startDate : Optional AdjustableOrRelativeDate
    -- ^ The start date of the calculation period. FpML
    --   specifies that for interest rate swaps this date must
    --   only be specified if it is not equal to the effective
    --   date. It is always specified in the case of equity
    --   swaps and credit default swaps with periodic
    --   payments. This date may be subject to adjustment in
    --   accordance with a business day convention.
  endDate : Optional AdjustableOrRelativeDate
    -- ^ The end date of the calculation period. FpML
    --   specifies that for interest rate swaps this date must
    --   only be specified if it is not equal to the
    --   termination date. It is always specified in the case
    --   of equity swaps with periodic payments. This date may
    --   be subject to adjustment in accordance with a
    --   business day convention.
  periodFrequency : Optional CalculationPeriodFrequency
    -- ^ The frequency at which calculation period end dates
    --   occur with the regular part of the calculation period
    --   schedule and their roll date convention.
  periodDatesAdjustments : Optional BusinessDayAdjustments
    -- ^ The specification of the business day convention and
    --   financial business centers used for adjusting any
    --   calculation period date if it would otherwise fall on
    --   a day that is not a business day in the specified
    --   business center.
  dayType : Optional DayTypeEnum
    -- ^ Denotes the enumerated values to specify the day type
    --   classification used in counting the number of days
    --   between two dates.
    deriving (Eq, Ord, Show)

-- | Comprises an identifier and a source. The associated
--   metadata key denotes the ability to associate a hash
--   value to the PersonIdentifier instantiations for the
--   purpose of model cross-referencing, in support of
--   functionality such as the event effect and the
--   lineage.
data PersonIdentifier = PersonIdentifier with 
  identifier : (FieldWithMeta Text)
    -- ^ Provides an identifier associated with a person. The
    --   identifier is unique within the public source
    --   specified in the source attribute.
  identifierType : Optional PersonIdentifierTypeEnum
    -- ^ Defines the source of the identifier.
  country : Optional (FieldWithMeta Text)
    -- ^ The ISO 3166 standard code for the country issuing
    --   the identifier.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

data PhysicalSettlementPeriod = PhysicalSettlementPeriod with 
  businessDaysNotSpecified : Optional Bool
    -- ^ An explicit indication that a number of business days
    --   are not specified and therefore ISDA fallback
    --   provisions should apply.
  businessDays : Optional Int
    -- ^ A number of business days. Its precise meaning is
    --   dependant on the context in which this element is
    --   used. ISDA 2003 Term: Business Day.
  maximumBusinessDays : Optional Int
    -- ^ A maximum number of business days. Its precise
    --   meaning is dependant on the context in which this
    --   element is used. Intended to be used to limit a
    --   particular ISDA fallback provision.
    deriving (Eq, Ord, Show)

-- | Specifies Physical Settlement Terms characteristics
--   for the settlement of a Credit Default Swap or
--   Option.
data PhysicalSettlementTerms = PhysicalSettlementTerms with 
  clearedPhysicalSettlement : Optional Bool
    -- ^ Specifies whether the swap resulting from physical
    --   settlement of the swaption transaction will clear
    --   through a clearing house. The meaning of Cleared
    --   Physical Settlement is defined in the 2006 ISDA
    --   Definitions, Section 15.2 (published in Supplement
    --   number 28).
  predeterminedClearingOrganizationParty : Optional AncillaryRoleEnum
    -- ^ Specifies the clearing organization (CCP, DCO) to
    --   which the trade should be cleared.
  physicalSettlementPeriod : Optional PhysicalSettlementPeriod
    -- ^ The number of business days used in the determination
    --   of the physical settlement date. The physical
    --   settlement date is this number of business days after
    --   all applicable conditions to settlement are
    --   satisfied. If a number of business days is not
    --   specified fallback provisions apply for determining
    --   the number of business days. If Section 8.5/8.6 of
    --   the 1999/2003 ISDA Definitions are to apply the
    --   businessDaysNotSpecified element should be included.
    --   If a specified number of business days are to apply
    --   these should be specified in the businessDays
    --   element. If Section 8.5/8.6 of the 1999/2003 ISDA
    --   Definitions are to apply but capped at a maximum
    --   number of business days then the maximum number
    --   should be specified in the maximumBusinessDays
    --   element. ISDA 2003 Term: Physical Settlement Period.
  deliverableObligations : Optional DeliverableObligations
    -- ^ This element contains all the ISDA terms relevant to
    --   defining the deliverable obligations.
  escrow : Optional Bool
    -- ^ If this element is specified and set to
    --   'true', indicates that physical settlement
    --   must take place through the use of an escrow agent.
    --   (For Canadian counterparties this is always 'Not
    --   Applicable'. ISDA 2003 Term: Escrow.
  sixtyBusinessDaySettlementCap : Optional Bool
    -- ^ If this element is specified and set to
    --   'true', for a transaction documented under
    --   the 2003 ISDA Credit Derivatives Definitions, has the
    --   effect of incorporating the language set forth below
    --   into the confirmation. The section references are to
    --   the 2003 ISDA Credit Derivatives Definitions.
    --   Notwithstanding Section 1.7 or any provisions of
    --   Sections 9.9 or 9.10 to the contrary, but without
    --   prejudice to Section 9.3 and (where applicable)
    --   Sections 9.4, 9.5 and 9.6, if the Termination Date
    --   has not occurred on or prior to the date that is 60
    --   Business Days following the Physical Settlement Date,
    --   such 60th Business Day shall be deemed to be the
    --   Termination Date with respect to this Transaction
    --   except in relation to any portion of the Transaction
    --   (an 'Affected Portion') in respect of which:
    --   (1) a valid notice of Buy-in Price has been delivered
    --   that is effective fewer than three Business Days
    --   prior to such 60th Business Day, in which case the
    --   Termination Date for that Affected Portion shall be
    --   the third Business Day following the date on which
    --   such notice is effective; or (2) Buyer has purchased
    --   but not Delivered Deliverable Obligations validly
    --   specified by Seller pursuant to Section 9.10(b), in
    --   which case the Termination Date for that Affected
    --   Portion shall be the tenth Business Day following the
    --   date on which Seller validly specified such
    --   Deliverable Obligations to Buyer.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A Portfolio represents an aggregation of multiple
--   Positions, by describing the parameters that this
--   Portfolio should be aggregated based on. The
--   resulting PortfolioState is calculated using these
--   aggregation parameters as inputs, by aggregating all
--   the Events that are relevant to this Portfolio. The
--   concept of Portfolio works at all levels in the
--   model: from the highest for a given LegalEntity for
--   instance, to the lowest to account for security
--   substitutions in a secutity financing transaction. As
--   such, Portfolio can be used either above or below the
--   Contract level.
data Portfolio = Portfolio with 
  aggregationParameters : AggregationParameters
    -- ^ Describes the portfolio by describing how to
    --   aggregate all its relevant Events.
  portfolioState : PortfolioState
    -- ^ Describes the state of the Portfolio as a list of
    --   Positions resulting from the aggregation.
    deriving (Eq, Ord, Show)

-- | Specifies an individual type of return of a
--   Performance Payout, when such individual return is
--   part of an aggregation of multiple similar returns,
--   at Performance Payout level.
data PortfolioReturnTerms = PortfolioReturnTerms with 
  priceReturnTerms : Optional PriceReturnTerms
    -- ^ Return terms based upon the underlier's observed
    --   price.
  dividendReturnTerms : Optional DividendReturnTerms
    -- ^ Return terms based upon dividend payments associated
    --   to the underlier.
  varianceReturnTerms : Optional VarianceReturnTerms
    -- ^ Return terms based upon the observed variance of the
    --   underlier's price.
  volatilityReturnTerms : Optional VolatilityReturnTerms
    -- ^ Return terms based upon the observed volatility of
    --   the underlier's price.
  correlationReturnTerms : Optional CorrelationReturnTerms
    -- ^ Return terms based upon the observed correlation
    --   between the components of the underlying basket.
  payerReceiver : PayerReceiver
    -- ^ Canonical representation of the payer and receiver
    --   parties applicable to each individual return leg.
  underlier : (ReferenceWithMeta Observable)
    -- ^ Defines the product that is the subject of a tradable
    --   product definition, an underlying product definition,
    --   a physical exercise, a position, or other purposes.
  quantity : Optional (ReferenceWithMeta NonNegativeQuantitySchedule)
    -- ^ Specifies a quantity schedule for the underlier,
    --   which applies to each individual return leg.
  initialValuationPrice : [ReferenceWithMeta PriceSchedule]
    -- ^ Specifies the initial valuation price(s) of the
    --   underlier. This price can be expressed either as an
    --   actual amount/currency, as a determination method, or
    --   by reference to another value specified in the swap
    --   document.
  interimValuationPrice : [ReferenceWithMeta PriceSchedule]
    -- ^ Specifies the initial valuation price(s) of the
    --   underlier. This price can be expressed either as an
    --   actual amount/currency, as a determination method, or
    --   by reference to another value specified in the swap
    --   document.
  finalValuationPrice : [ReferenceWithMeta PriceSchedule]
    -- ^ 2018 ISDA CDM Equity Confirmation for Security Equity
    --   Swap: Final Price | Specifies the final valuation
    --   price of the underlier. This price can be expressed
    --   either as an actual amount/currency, as a
    --   determination method, or by reference to another
    --   value specified in the swap document.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | State-full representation of a Portfolio that
--   describes all the positions held at a given time, in
--   various states which can be either traded, settled,
--   etc., with lineage information to the previous state
data PortfolioState = PortfolioState with 
  positions : [Position]
    -- ^ The list of positions, each containing a Quantity and
    --   a Product.
  lineage : Lineage
    -- ^ Pointer to the previous PortfolioState and new
    --   Event(s) leading to the current (new) state. Previous
    --   PortfolioState in the Lineage can be Null in case
    --   this is the start of the chain of Events.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A Position describes how much of a given Product is
--   being held and constitutes the atomic element of a
--   Portfolio.
data Position = Position with 
  priceQuantity : [PriceQuantity]
    -- ^ Position with many price quantities.
  product : Product
    -- ^ The product underlying the position.
  cashBalance : Optional Money
    -- ^ The aggregate cost of proceeds
  tradeReference : Optional (ReferenceWithMeta TradeState)
    -- ^ Reference to the Contract, in case product is
    --   contractual and the contract has been formed
    deriving (Eq, Ord, Show)

-- | Defines a position identifier as a special case of
--   the generic identifier type, that also includes the
--   position identifier class.
data PositionIdentifier = PositionIdentifier with 
  issuerReference : Optional (ReferenceWithMeta Party)
    -- ^ The identifier issuer, when specified by reference to
    --   a party specified as part of the transaction.
  issuer : Optional (FieldWithMeta Text)
    -- ^ The identifier issuer, when specified explicitly
    --   alongside the identifier value (instead of being
    --   specified by reference to a party).
  assignedIdentifier : [AssignedIdentifier]
    -- ^ The identifier value. This level of indirection
    --   between the issuer and the identifier and its version
    --   provides the ability to associate multiple
    --   identifiers to one issuer, consistently with the FpML
    --   PartyTradeIdentifier.
  meta : Optional MetaFields
  identifierType : Optional TradeIdentifierTypeEnum
    -- ^ The enumerated classification of the identifier.
    --   Optional as a position identifier may be
    --   party-specific, in which case it may not correspond
    --   to any established classification.
    deriving (Eq, Ord, Show)

-- | This class corresponds to the FpML Premium.model
--   group for representing the option premium when
--   expressed in a way other than an amount.
data PremiumExpression = PremiumExpression with 
  premiumType : Optional PremiumTypeEnum
    -- ^ Forward start premium type
  pricePerOption : Optional Money
    -- ^ The amount of premium to be paid expressed as a
    --   function of the number of options.
  percentageOfNotional : Optional Decimal
    -- ^ The amount of premium to be paid expressed as a
    --   percentage of the notional value of the transaction.
    --   A percentage of 5% would be expressed as 0.05.
    deriving (Eq, Ord, Show)

data Pric = Pric with 
  pric : Pric
  bsisPts : Text
    deriving (Eq, Ord, Show)

-- | Specifies a price as a single value to be associated
--   to a financial product. This data type extends
--   PriceSchedule and requires that only the amount value
--   exists.
data Price = Price with 
  value : Optional Decimal
    -- ^ Specifies the value of the measure as a number.
    --   Optional because in a measure vector or schedule,
    --   this single value may be omitted.
  unit : Optional UnitType
    -- ^ Qualifies the unit by which the amount is measured.
    --   Optional because a measure may be unit-less (e.g.
    --   when representing a ratio between amounts in the same
    --   unit).
  datedValue : [DatedValue]
    -- ^ A schedule of step date and value pairs. On each step
    --   date the associated step value becomes effective. The
    --   step dates are used to order the steps by ascending
    --   order. This attribute is optional so the data type
    --   may be used to define a schedule with a single value.
  perUnitOf : Optional UnitType
    -- ^ Provides an attribute to define the unit of the thing
    --   being priced. For example, {amount, unitOfAmount,
    --   PerUnitOfAmount} = [10, EUR, Shares] = (10.00
    --   EUR/SHARE) * (300,000 SHARES) = EUR 3,000,000.00
    --   (Shares cancel out in the calculation).
  priceType : PriceTypeEnum
    -- ^ Specifies the price type as an enumeration: interest
    --   rate, exchange rate, asset price etc. This attribute
    --   is mandatory so that prices can always be clasiffied
    --   according to their type. The price type implies some
    --   constraints on the price's units.
  priceExpression : Optional PriceExpressionEnum
    -- ^ (Optionally) Specifies whether the price is expressed
    --   in absolute or percentage terms.
  composite : Optional PriceComposite
    -- ^ (Optionally) Specifies the underlying price
    --   components if the price can be expressed as a
    --   composite: e.g. dirty price = clean price + accrued.
  arithmeticOperator : Optional ArithmeticOperationEnum
    -- ^ (Optionally) When the price is to be understood as an
    --   operator to apply to an observable, i.e. a spread,
    --   multiplier or min/max.
  cashPrice : Optional CashPrice
    -- ^ (Optionally when the price type is cash) Additional
    --   attributes that further define a cash price, e.g.
    --   what type of fee it is.
    deriving (Eq, Ord, Show)

-- | Defines the inputs required to calculate a price as a
--   simple composite of 2 other values. The inputs
--   consist of 2 numbers and a simple arithmetic
--   operator. This generic data type applies to a variety
--   of use cases where a price is obtained by simple
--   composition, e.g. dirty = clean + accrued (Bond),
--   forward rate = spot rate + forward point (FX) etc.
data PriceComposite = PriceComposite with 
  baseValue : Decimal
    -- ^ The 1st value in the arithmetic operation, which may
    --   be non-commutative in some cases: Subtract, Divide).
    --   This 1st operand is called 'baseValue' as it
    --   refers to the price anchor in the arithmetic
    --   operation: e.g. the clean price (Bond) or the spot
    --   rate (FX).
  operand : Decimal
    -- ^ The 2nd value in the arithmetic operation, which may
    --   be non-commutative in some cases: Subtract, Divide).
    --   The 2nd operand is called 'operand' to
    --   distinguish it from the 1st one which is the price
    --   anchor.
  arithmeticOperator : ArithmeticOperationEnum
    -- ^ Specifies the arithmetic operator via an enumeration.
  operandType : Optional PriceOperandEnum
    -- ^ Optionally qualifies the type of operand: e.g.
    --   accrued or forward point.
    deriving (Eq, Ord, Show)

-- | Defines a settlement as an exchange between two
--   parties of a specified quantity of an asset (the
--   quantity) against a specified quantity of another
--   asset (the price). The settlement is optional and can
--   be either cash or physical. The quantity can
--   additionally be specified in terms of one or more
--   currency amounts. In the case of non-cash products,
--   the settlement of the price/quantity would not be
--   specified here and instead would be delegated to the
--   product mechanics, as parameterised by the
--   price/quantity values.
data PriceQuantity = PriceQuantity with 
  price : [FieldWithMeta PriceSchedule]
    -- ^ Specifies a price to be used for trade amounts and
    --   other purposes.
  quantity : [FieldWithMeta NonNegativeQuantitySchedule]
    -- ^ Specifies a quantity to be associated with an event,
    --   for example a trade amount.
  observable : Optional (FieldWithMeta Observable)
    -- ^ Specifies the object to be observed for a price, it
    --   could be an asset or an index. The cardinality is
    --   optional as some quantity / price cases have no
    --   observable (e.g. a fixed rate in a given currency).
  effectiveDate : Optional AdjustableOrRelativeDate
    -- ^ Specifies the date at which the price and quantity
    --   become effective. This day may be subject to
    --   adjustment in accordance with a business day
    --   convention, or could be specified as relative to a
    --   trade date, for instance. Optional cardinality, as
    --   the effective date is usually specified in the
    --   product definition, so it may only need to be
    --   specified as part of the PriceQuantity in an
    --   increase/decrease scenario for an existing trade.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

data PriceReturnTerms = PriceReturnTerms with 
  returnType : ReturnTypeEnum
    -- ^ The type of return associated with the equity swap.
  conversionFactor : Optional Decimal
    -- ^ Defines the conversion applied if the quantity unit
    --   on contract is different from unit on referenced
    --   underlier.
  performance : Optional Text
    -- ^ Performance calculation, in accordance with Part 1
    --   Section 12 of the 2018 ISDA CDM Equity Confirmation
    --   for Security Equity Swap, Para 75. 'Equity
    --   Performance'. Cumulative performance is used as a
    --   notional multiplier factor on both legs of an Equity
    --   Swap.
    deriving (Eq, Ord, Show)

-- | Specifies the price of a financial instrument in a
--   trade as a schedule of measures. A price generically
--   expresses the value of an exchange as a ratio: it
--   measures the amount of one thing needed to be
--   exchanged for 1 unit of another thing (e.g. cash in a
--   specific currency in exchange for a bond or share).
--   This generic representation can be used to support
--   any type of financial price beyond just cash price:
--   e.g. an interest rate, a foreign exchange rate, etc.
--   This data type is generically based on a schedule and
--   can also be used to represent a price as a single
--   value.
data PriceSchedule = PriceSchedule with 
  value : Optional Decimal
    -- ^ Specifies the value of the measure as a number.
    --   Optional because in a measure vector or schedule,
    --   this single value may be omitted.
  unit : Optional UnitType
    -- ^ Qualifies the unit by which the amount is measured.
    --   Optional because a measure may be unit-less (e.g.
    --   when representing a ratio between amounts in the same
    --   unit).
  datedValue : [DatedValue]
    -- ^ A schedule of step date and value pairs. On each step
    --   date the associated step value becomes effective. The
    --   step dates are used to order the steps by ascending
    --   order. This attribute is optional so the data type
    --   may be used to define a schedule with a single value.
  perUnitOf : Optional UnitType
    -- ^ Provides an attribute to define the unit of the thing
    --   being priced. For example, {amount, unitOfAmount,
    --   PerUnitOfAmount} = [10, EUR, Shares] = (10.00
    --   EUR/SHARE) * (300,000 SHARES) = EUR 3,000,000.00
    --   (Shares cancel out in the calculation).
  priceType : PriceTypeEnum
    -- ^ Specifies the price type as an enumeration: interest
    --   rate, exchange rate, asset price etc. This attribute
    --   is mandatory so that prices can always be clasiffied
    --   according to their type. The price type implies some
    --   constraints on the price's units.
  priceExpression : Optional PriceExpressionEnum
    -- ^ (Optionally) Specifies whether the price is expressed
    --   in absolute or percentage terms.
  composite : Optional PriceComposite
    -- ^ (Optionally) Specifies the underlying price
    --   components if the price can be expressed as a
    --   composite: e.g. dirty price = clean price + accrued.
  arithmeticOperator : Optional ArithmeticOperationEnum
    -- ^ (Optionally) When the price is to be understood as an
    --   operator to apply to an observable, i.e. a spread,
    --   multiplier or min/max.
  cashPrice : Optional CashPrice
    -- ^ (Optionally when the price type is cash) Additional
    --   attributes that further define a cash price, e.g.
    --   what type of fee it is.
    deriving (Eq, Ord, Show)

-- | Specifies a publication that provides the commodity
--   price, including, where applicable, the details of
--   where in the publication the price is published.
data PriceSource = PriceSource with 
  pricePublisher : (FieldWithMeta Text)
    -- ^ Defines a publication in which the price can be
    --   found. (e.g Gas Daily, Platts Bloomberg. Commodity
    --   publishers can be found at this URL: 
    --   http://www.fpml.org/coding-scheme/commodity-information-provider>
  priceSourceLocation : Optional Text
    -- ^ Specifies the location of the price which may be a
    --   specific page, electornic screen name, or a code
    --   (e.g. a RIC code) where the price can be found.
  priceSourceHeading : Optional Text
    -- ^ Specifies the heading or field name for the price  on
    --   a given page or screen, where applicable.
  priceSourceTime : Optional Text
    -- ^ Specifies the time at which the price should be
    --   observed.
    deriving (Eq, Ord, Show)

-- | A data defining:  the parameters used to get a price
--   quote to replace the settlement rate option that is
--   disrupted.
data PriceSourceDisruption = PriceSourceDisruption with 
  fallbackReferencePrice : FallbackReferencePrice
    -- ^ The method, prioritised by the order it is listed in
    --   this element, to get a replacement rate for the
    --   disrupted settlement rate option.
    deriving (Eq, Ord, Show)

-- | Specifies specific dates or parametric rules for the
--   dates on which the price will be determined
data PricingDates = PricingDates with 
  specifiedDates : [AdjustableDates]
    -- ^ Defines specified dates on which the price will be
    --   determined.
  parametricDates : Optional ParametricDates
    -- ^ Defines rules for the dates on which the price will
    --   be determined.
    deriving (Eq, Ord, Show)

-- | A Primitive Instruction describes the inputs required
--   to pass into the corresponding PrimitiveEvent
--   function.
data PrimitiveInstruction = PrimitiveInstruction with 
  contractFormation : Optional ContractFormationInstruction
    -- ^ Specifies instructions describing an contract
    --   formation primitive event.
  execution : Optional ExecutionInstruction
    -- ^ Specifies instructions describing an execution
    --   primitive event.
  exercise : Optional ExerciseInstruction
    -- ^ Specifies instructions describing an exercise
    --   primitive event.
  partyChange : Optional PartyChangeInstruction
    -- ^ Specifies instructions describing a party change
    --   primitive event.
  quantityChange : Optional QuantityChangeInstruction
    -- ^ Specifies instructions describing an quantity change
    --   primitive event.
  reset : Optional ResetInstruction
    -- ^ Specifies instructions describing a reset event.
  split : Optional SplitInstruction
    -- ^ Specifies instructions to split a trade into multiple
    --   branches.
  termsChange : Optional TermsChangeInstruction
    -- ^ Specifies instructions describing a terms change
    --   primitive event.
  transfer : Optional TransferInstruction
    -- ^ Specifies instructions describing a transfer
    --   primitive event.
  indexTransition : Optional IndexTransitionInstruction
    -- ^ Specifies inputs needed to process a Index Transition
    --   business event.
  stockSplit : Optional StockSplitInstruction
    -- ^ Specifies inputs needed to process a Stock Split
    --   business event.
  observation : Optional ObservationInstruction
    -- ^ Specifies inputs needed to process an observation.
  valuation : Optional ValuationInstruction
    -- ^ Specifies inputs needed to process an update of a
    --   valuation.
    deriving (Eq, Ord, Show)

-- | Any kind of principal payments when the amount is
--   known and thus fixed.
data PrincipalPayment = PrincipalPayment with 
  principalPaymentDate : Optional AdjustableDate
    -- ^ The date where the PrincipalPayment shall be settled.
  payerReceiver : Optional PayerReceiver
    -- ^ Specifies the parties responsible for making and
    --   receiving payments defined by this structure.
  principalAmount : Optional Money
    -- ^ When known at the time the transaction is made, the
    --   cash amount to be paid.
  discountFactor : Optional Decimal
    -- ^ The value representing the discount factor used to
    --   calculate the present value of the principal payment
    --   amount.
  presentValuePrincipalAmount : Optional Money
    -- ^ The amount representing the present value of the
    --   principal payment.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | Describe dates schedules for Principal Exchanges and
--   related role of the parties when known.
data PrincipalPaymentSchedule = PrincipalPaymentSchedule with 
  initialPrincipalPayment : Optional PrincipalPayment
    -- ^ Principal Payment made at Trade inception.
  intermediatePrincipalPayment : Optional AdjustableRelativeOrPeriodicDates
    -- ^ Principal Payment as part of the Trade lifecycle e.g.
    --   as part of notional reset adjustements in a Cross
    --   Currency Swap with a varying notional leg.
  finalPrincipalPayment : Optional PrincipalPayment
    -- ^ Principal Payment at Trade maturity
    deriving (Eq, Ord, Show)

-- | A class defining which principal exchanges occur for
--   the stream.
data PrincipalPayments = PrincipalPayments with 
  initialPayment : Bool
    -- ^ A true/false flag to indicate whether there is an
    --   initial exchange of principal on the effective date.
  finalPayment : Bool
    -- ^ A true/false flag to indicate whether there is a
    --   final exchange of principal on the termination date.
  intermediatePayment : Bool
    -- ^ A true/false flag to indicate whether there are
    --   intermediate or interim exchanges of principal during
    --   the term of the swap.
  varyingLegNotionalCurrency : [Text]
    -- ^ Indicate the Payout legs which nominal amount may
    --   vary in regards of FX Fixing dates as determined in
    --   the product terms.
  principalPaymentSchedule : Optional PrincipalPaymentSchedule
    -- ^ Describe dates schedules for Principal Exchanges and
    --   related role of the parties when known.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | Enables either a TransferableProduct or a
--   NonTransferableProduct to be used in an underlier.
data Product = Product with 
  transferableProduct : Optional TransferableProduct
    -- ^ A TransferableProduct is a type of financial product
    --   which can be held or transferred, represented as an
    --   Asset with the addition of specific EconomicTerms.
  nonTransferableProduct : Optional NonTransferableProduct
    -- ^ The non-transferable product data type represents a
    --   product that can be traded (as part of a
    --   TradableProduct) but cannot be transferred to others.
    deriving (Eq, Ord, Show)

-- | Comprises an identifier and a source. The associated
--   metadata key denotes the ability to associate a hash
--   value to the ProductIdentifier instantiations for the
--   purpose of model cross-referencing, in support of
--   functionality such as the event effect and the
--   lineage.
data ProductIdentifier = ProductIdentifier with 
  identifier : (FieldWithMeta Text)
    -- ^ Provides an identifier associated with a specific
    --   product.  The identifier is unique within the public
    --   source specified in the source attribute.
  source : ProductIdTypeEnum
    -- ^ Defines the source of the identifier.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | Specifies the product taxonomy, which is composed of
--   a taxonomy value and a taxonomy source.
data ProductTaxonomy = ProductTaxonomy with 
  source : Optional TaxonomySourceEnum
    -- ^ The source of the taxonomy that defines the rules for
    --   classifying the object. The taxonomy source is taken
    --   from a enumerated list of taxonomy names. Optional as
    --   the taxonomy source may not be provided.
  value : Optional TaxonomyValue
    -- ^ The value according to that taxonomy. Optional as it
    --   may not be possible to classify the object in that
    --   taxonomy.
  primaryAssetClass : Optional (FieldWithMeta AssetClassEnum)
    -- ^ Classifies the most important risk class of the
    --   trade.
  secondaryAssetClass : [FieldWithMeta AssetClassEnum]
    -- ^ Classifies additional risk classes of the trade, if
    --   any.
  productQualifier : Optional Text
    -- ^ Derived from the product payout features using a CDM
    --   product qualification function that determines the
    --   product type based on the product payout features.
    deriving (Eq, Ord, Show)

-- | A class to specify the terms for calculating a payout
--   to protect the buyer of the swap in the case of a
--   qualified credit event. These terms include the
--   applicable credit events, the reference obligation,
--   and in the case of a CDS on mortgage-backed
--   securities, the floatingAmountEvents.
data ProtectionTerms = ProtectionTerms with 
  creditEvents : Optional CreditEvents
    -- ^ Specifies the applicable Credit Events that would
    --   trigger a settlement, as specified in the related
    --   Confirmation and defined in the ISDA 2014 Credit
    --   Definition article IV section 4.1.
  obligations : Optional Obligations
    -- ^ The underlying obligations of the reference entity on
    --   which you are buying or selling protection. The
    --   credit events Failure to Pay, Obligation
    --   Acceleration, Obligation Default, Restructuring,
    --   Repudiation/Moratorium are defined with respect to
    --   these obligations.
  floatingAmountEvents : Optional FloatingAmountEvents
    -- ^ This element contains the ISDA terms relating to the
    --   floating rate payment events and the implied
    --   additional fixed payments, applicable to the credit
    --   derivatives transactions on mortgage-backed
    --   securities with pay-as-you-go or physical settlement.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

data Prsn = Prsn with 
  ctryOfBrnch : Text
  othr : Othr
    deriving (Eq, Ord, Show)

data PubliclyAvailableInformation = PubliclyAvailableInformation with 
  standardPublicSources : Optional Bool
    -- ^ If this element is specified and set to
    --   'true', indicates that ISDA defined Standard
    --   Public Sources are applicable.
  publicSource : [Text]
    -- ^ A public information source, e.g. a particular
    --   newspaper or electronic news service, that may
    --   publish relevant information used in the
    --   determination of whether or not a credit event has
    --   occurred. ISDA 2003 Term: Public Source.
  specifiedNumber : Optional Int
    -- ^ The minimum number of the specified public
    --   information sources that must publish information
    --   that reasonably confirms that a credit event has
    --   occurred. The market convention is two. ISDA 2003
    --   Term: Specified Number.
    deriving (Eq, Ord, Show)

data Qty = Qty with 
  unit : Text
    deriving (Eq, Ord, Show)

-- | Specifies a quantity as a single value to be
--   associated to a financial product, for example a
--   transfer amount resulting from a trade. This data
--   type extends QuantitySchedule and requires that only
--   the single amount value exists.
data Quantity = Quantity with 
  value : Optional Decimal
    -- ^ Specifies the value of the measure as a number.
    --   Optional because in a measure vector or schedule,
    --   this single value may be omitted.
  unit : Optional UnitType
    -- ^ Qualifies the unit by which the amount is measured.
    --   Optional because a measure may be unit-less (e.g.
    --   when representing a ratio between amounts in the same
    --   unit).
  datedValue : [DatedValue]
    -- ^ A schedule of step date and value pairs. On each step
    --   date the associated step value becomes effective. The
    --   step dates are used to order the steps by ascending
    --   order. This attribute is optional so the data type
    --   may be used to define a schedule with a single value.
  multiplier : Optional Measure
    -- ^ Defines an optional number that the quantity should
    --   be multiplied by to derive a total quantity. This
    --   number is associated to a unit. For example in the
    --   case of the Coal (API2) CIF ARA (ARGUS-McCloskey)
    --   Futures Contract on the CME, where the unit would be
    --   contracts, the multiplier value would 1,000 and the
    --   mulitiplier unit would be 1,000 MT (Metric Tons).
  frequency : Optional Frequency
    -- ^ Defines the frequency to be used when defining a
    --   quantity. For example a quantity may be specified as
    --   a number of barrels of oil per day, which needs
    --   multiplying by the number of days in the relevant
    --   period to get the total quantity as a number of
    --   barrels.
    deriving (Eq, Ord, Show)

-- | Instructions required to create a Quantity Change
--   Primitive Event, which can be either an increase, a
--   decrease or a replacement. An increase adds a new
--   trade lot to the original trade, whereas a decrease
--   subtracts from an existing trade lot's quantity.
--   A replacement updates the quantity of an existing
--   trade lot to the new value.
data QuantityChangeInstruction = QuantityChangeInstruction with 
  change : [PriceQuantity]
    -- ^ Quantity by which the trade is being increased,
    --   decreased or replaced, and the price at which such
    --   quantity change is agreed. The quantity change should
    --   always be specified as a positive number, with the
    --   direction (increase/decrease/replacement) being
    --   specified by the direction enumeration. A fee can
    --   also be associated to the quantity change by
    --   specifying a Price component of type CashPrice,
    --   including the corresponding settlement date and
    --   direction.
  direction : QuantityChangeDirectionEnum
    -- ^ Direction of the quantity change specified as either
    --   an increase, decrease or replacement.
  lotIdentifier : [Identifier]
    -- ^ Identifier for the new lot (in case of increase) or
    --   for the existing lot to be changed(in case of
    --   decrease or replacement). This optional attribute is
    --   mandatory in case of a decrease or replacement if the
    --   initial trade state contains multiple trade lots.
    deriving (Eq, Ord, Show)

-- | Class to specify a mechanism for a quantity to be set
--   as a multiplier to another (reference) quantity,
--   based on a price observation. At the moment this
--   class only supports FX or Equity-linked notional and
--   re-uses existing building blocks for those 2 cases,
--   until such time when component can be made more
--   generic. This captures the case of resetting
--   cross-currency swaps and resetting equity swaps.
data QuantityMultiplier = QuantityMultiplier with 
  fxLinkedNotionalSchedule : Optional FxLinkedNotionalSchedule
    -- ^ Multiplier specified as an FX-linked schedule, e.g.
    --   for a resetting cross-currency swap..
  multiplierValue : Optional Decimal
    deriving (Eq, Ord, Show)

-- | Specifies a quantity schedule to be associated to a
--   financial product to represent a trade amount. This
--   data type extends MeasureSchedule with several unit
--   or multiplier attributes that are used to define
--   financial quantities. This data type is generically
--   based on a schedule and can also be used to represent
--   a quantity as a single value.
data QuantitySchedule = QuantitySchedule with 
  value : Optional Decimal
    -- ^ Specifies the value of the measure as a number.
    --   Optional because in a measure vector or schedule,
    --   this single value may be omitted.
  unit : Optional UnitType
    -- ^ Qualifies the unit by which the amount is measured.
    --   Optional because a measure may be unit-less (e.g.
    --   when representing a ratio between amounts in the same
    --   unit).
  datedValue : [DatedValue]
    -- ^ A schedule of step date and value pairs. On each step
    --   date the associated step value becomes effective. The
    --   step dates are used to order the steps by ascending
    --   order. This attribute is optional so the data type
    --   may be used to define a schedule with a single value.
  multiplier : Optional Measure
    -- ^ Defines an optional number that the quantity should
    --   be multiplied by to derive a total quantity. This
    --   number is associated to a unit. For example in the
    --   case of the Coal (API2) CIF ARA (ARGUS-McCloskey)
    --   Futures Contract on the CME, where the unit would be
    --   contracts, the multiplier value would 1,000 and the
    --   mulitiplier unit would be 1,000 MT (Metric Tons).
  frequency : Optional Frequency
    -- ^ Defines the frequency to be used when defining a
    --   quantity. For example a quantity may be specified as
    --   a number of barrels of oil per day, which needs
    --   multiplying by the number of days in the relevant
    --   period to get the total quantity as a number of
    --   barrels.
    deriving (Eq, Ord, Show)

-- | Determines the currency rate that the seller of the
--   equity amounts will apply at each valuation date for
--   converting the respective amounts into a currency
--   that is different from the currency denomination of
--   the underlier.
data Quanto = Quanto with 
  fxRate : [FxRate]
    -- ^ Specifies a currency conversion rate.
  fxSpotRateSource : Optional FxSpotRateSource
    -- ^ Specifies the methodology (reference source and,
    --   optionally, fixing time) to be used for determining a
    --   currency conversion rate.
  fixingTime : Optional BusinessCenterTime
    -- ^ The time at which the spot currency exchange rate
    --   will be observed. It is specified as a time in a
    --   business day calendar location, e.g. 11:00am London
    --   time.
    deriving (Eq, Ord, Show)

-- | Represents a class to allow specification of
--   different types of Quasi Government collateral.
data QuasiGovernmentIssuerType = QuasiGovernmentIssuerType with 
  sovereignEntity : Bool
    -- ^ True if sovereign entity (e.g. not separate legal
    --   personality from sovereign) or false if non-sovereign
    --   entity (e.g. separate legal personality from
    --   sovereign).
  sovereignRecourse : Optional Bool
    -- ^ Applies to non-sovereign entity (e.g. separate legal
    --   personality from sovereign).  True if entity has
    --   recourse to sovereign (e.g. debt guaranteed by
    --   government).  False if entity does not have recourse
    --   to sovereign.
    deriving (Eq, Ord, Show)

-- | A class that describes the composition of a rate that
--   has been quoted or is to be quoted. This includes the
--   two currencies and the quotation relationship between
--   the two currencies and is used as a building block
--   throughout the FX specification.
data QuotedCurrencyPair = QuotedCurrencyPair with 
  currency1 : (FieldWithMeta Text)
    -- ^ The first currency specified when a pair of
    --   currencies is to be evaluated.
  currency2 : (FieldWithMeta Text)
    -- ^ The second currency specified when a pair of
    --   currencies is to be evaluated.
  quoteBasis : QuoteBasisEnum
    -- ^ The method by which the exchange rate is quoted.
    deriving (Eq, Ord, Show)

-- | A class defining parameters associated with an
--   individual observation or fixing. This class forms
--   part of the cashflow representation of a stream.
data RateObservation = RateObservation with 
  resetDate : Optional Date
    -- ^ The reset date.
  adjustedFixingDate : Optional Date
    -- ^ The adjusted fixing date, i.e. the actual date the
    --   rate is observed. The date should already be adjusted
    --   for any applicable business day convention.
  observedRate : Optional Decimal
    -- ^ The actual observed rate before any required rate
    --   treatment is applied, e.g. before converting a rate
    --   quoted on a discount basis to an equivalent yield. An
    --   observed rate of 5% would be represented as 0.05.
  treatedRate : Optional Decimal
    -- ^ The observed rate after any required rate treatment
    --   is applied. A treated rate of 5% would be represented
    --   as 0.05.
  observationWeight : Optional Int
    -- ^ The number of days weighting to be associated with
    --   the rate observation, i.e. the number of days such
    --   rate is in effect. This is applicable in the case of
    --   a weighted average method of calculation where more
    --   than one reset date is established for a single
    --   calculation period.
  rateReference : Optional (ReferenceWithMeta RateObservation)
    -- ^ A pointer style reference to a floating rate
    --   component defined as part of a stub calculation
    --   period amount component. It is only required when it
    --   is necessary to distinguish two rate observations for
    --   the same fixing date which could occur when linear
    --   interpolation of two different rates occurs for a
    --   stub calculation period.
  forecastRate : Optional Decimal
    -- ^ The value representing the forecast rate used to
    --   calculate the forecast future value of the accrual
    --   period.A value of 1% should be represented as 0.01.
  treatedForecastRate : Optional Decimal
    -- ^ The value representing the forecast rate after
    --   applying rate treatment rules. A value of 1% should
    --   be represented as 0.01.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A class defining a schedule of rates or amounts in
--   terms of an initial value and then a series of step
--   date and value pairs. On each step date the rate or
--   amount changes to the new step value. The series of
--   step date and value pairs are optional. If not
--   specified, this implies that the initial value
--   remains unchanged over time.
data RateSchedule = RateSchedule with 
  price : (ReferenceWithMeta PriceSchedule)
    -- ^ The initial rate. An initial rate of 5% would be
    --   represented as 0.05.
    deriving (Eq, Ord, Show)

-- | A data type to specify the fixed interest rate,
--   floating interest rate or inflation rate.
data RateSpecification = RateSpecification with 
  fixedRateSpecification : Optional FixedRateSpecification
    -- ^ The fixed rate or fixed rate specification expressed
    --   as explicit fixed rates and dates.
  floatingRateSpecification : Optional FloatingRateSpecification
    -- ^ The floating interest rate specification, which
    --   includes the definition of the floating rate index.
    --   the tenor, the initial value, and, when applicable,
    --   the spread, the rounding convention, the averaging
    --   method and the negative interest rate treatment.
  inflationRateSpecification : Optional InflationRateSpecification
    -- ^ An inflation rate calculation definition.
    deriving (Eq, Ord, Show)

data RefRate = RefRate with 
  indx : Text
  nm : Text
    deriving (Eq, Ord, Show)

-- | A class to describe an institution (party) identified
--   by means of a coding scheme and an optional name.
data ReferenceBank = ReferenceBank with 
  referenceBankId : (FieldWithMeta Text)
    -- ^ An institution (party) identifier, e.g. a bank
    --   identifier code (BIC). FpML specifies a
    --   referenceBankIdScheme.
  referenceBankName : Optional Text
    -- ^ The name of the institution (party). A free format
    --   string. FpML does not define usage rules for the
    --   element.
    deriving (Eq, Ord, Show)

-- | A class defining the list of reference institutions
--   polled for relevant rates or prices when determining
--   the cash settlement amount for a product where cash
--   settlement is applicable.
data ReferenceBanks = ReferenceBanks with 
  referenceBank : [ReferenceBank]
    -- ^ An institution (party) identified by means of a
    --   coding scheme and an optional name.
    deriving (Eq, Ord, Show)

-- | A class specifying the Credit Default Swap Reference
--   Information.
data ReferenceInformation = ReferenceInformation with 
  referenceEntity : LegalEntity
    -- ^ The corporate or sovereign entity which is subject to
    --   the swap transaction and any successor that assumes
    --   all or substantially all of its contractual and other
    --   obligations. Reference Entities cannot be senior or
    --   subordinated. It is the obligations of the Reference
    --   Entities that can be senior or subordinated. ISDA
    --   2014 Credit definitions article II section 2.1:
    --   `Reference Entity` means the entity specified as such
    --   in the related Confirmation.
  referenceObligation : [ReferenceObligation]
    -- ^ The Reference Obligation is a financial instrument
    --   that is either issued or guaranteed by the reference
    --   entity. It serves to clarify the precise reference
    --   entity protection is being offered upon, and its
    --   legal position with regard to other related firms
    --   (parents/subsidiaries). Furthermore the Reference
    --   Obligation is ALWAYS deliverable and establishes the
    --   Pari Passu ranking (as the deliverable bonds must
    --   rank equal to the reference obligation). ISDA 2003
    --   Term: Reference Obligation.
  noReferenceObligation : Optional Bool
    -- ^ Used to indicate that there is no Reference
    --   Obligation associated with this Credit Default Swap
    --   and that there will never be one.
  unknownReferenceObligation : Optional Bool
    -- ^ Used to indicate that the Reference obligation
    --   associated with the Credit Default Swap is currently
    --   not known. This is not valid for Legal Confirmation
    --   purposes, but is valid for earlier stages in the
    --   trade life cycle (e.g. Broker Confirmation).
  allGuarantees : Optional Bool
    -- ^ Indicates whether an obligation of the Reference
    --   Entity, guaranteed by the Reference Entity on behalf
    --   of a non-Affiliate, is to be considered an Obligation
    --   for the purpose of the transaction. It will be
    --   considered an obligation if allGuarantees is
    --   applicable (true) and not if allGuarantees is
    --   inapplicable (false). ISDA 2003 Term: All Guarantees.
  referencePrice : Optional Price
    -- ^ Used to determine (a) for physically settled trades,
    --   the Physical Settlement Amount, which equals the
    --   Floating Rate Payer Calculation Amount times the
    --   Reference Price and (b) for cash settled trades, the
    --   Cash Settlement Amount, which equals the greater of
    --   (i) the difference between the Reference Price and
    --   the Final Price and (ii) zero. ISDA 2003 Term:
    --   Reference Price.
  referencePolicy : Optional Bool
    -- ^ Applicable to the transactions on mortgage-backed
    --   security, which can make use of a reference policy.
    --   Presence of the element with value set to
    --   'true' indicates that the reference policy is
    --   applicable; absence implies that it is not.
  securedList : Optional Bool
    -- ^ With respect to any day, the list of Syndicated
    --   Secured Obligations of the Designated Priority of the
    --   Reference Entity published by Markit Group Limited or
    --   any successor thereto appointed by the Specified
    --   Dealers (the 'Secured List Publisher') on or
    --   most recently before such day, which list is
    --   currently available at [http://www.markit.com]. ISDA
    --   2003 Term: Relevant Secured List.
    deriving (Eq, Ord, Show)

-- | A class to specify the reference obligation that is
--   associated with a credit derivative instrument.
data ReferenceObligation = ReferenceObligation with 
  security : Optional Security
    -- ^ Identifies the underlying asset when it is a
    --   security, such as a bond or convertible bond. The
    --   security data type requires one or more
    --   productIdentifiers, specificaiton of the security
    --   type (e.g. debt), and includes optional attributes to
    --   specify a debt class, such as asset-backed, as well
    --   as seniority.
  loan : Optional Loan
    -- ^ Identifies the underlying asset when it is a loan.
  primaryObligor : Optional LegalEntity
    -- ^ The entity primarily responsible for repaying debt to
    --   a creditor as a result of borrowing or issuing bonds.
    --   ISDA 2003 Term: Primary Obligor.
  primaryObligorReference : Optional (ReferenceWithMeta LegalEntity)
    -- ^ A pointer style reference to a reference entity
    --   defined elsewhere in the document. Used when the
    --   reference entity is the primary obligor.
  guarantor : Optional LegalEntity
    -- ^ The party that guarantees by way of a contractual
    --   arrangement to pay the debts of an obligor if the
    --   obligor is unable to make the required payments
    --   itself. ISDA 2003 Term: Guarantor.
  guarantorReference : Optional Text
    -- ^ A pointer style reference to a reference entity
    --   defined elsewhere in the document. Used when the
    --   reference entity is the guarantor.
  standardReferenceObligation : Optional Bool
    -- ^ Indicates if the reference obligation is a Standard
    --   Reference Obligation. ISDA 2014 Term: Standard
    --   Reference Obligation.
    deriving (Eq, Ord, Show)

data ReferencePair = ReferencePair with 
  referenceEntity : LegalEntity
    -- ^ The corporate or sovereign entity on which you are
    --   buying or selling protection and any successor that
    --   assumes all or substantially all of its contractual
    --   and other obligations. It is vital to use the correct
    --   legal name of the entity and to be careful not to
    --   choose a subsidiary if you really want to trade
    --   protection on a parent company. Please note,
    --   Reference Entities cannot be senior or subordinated.
    --   It is the obligations of the Reference Entities that
    --   can be senior or subordinated. ISDA 2003 Term:
    --   Reference Entity.
  referenceObligation : Optional ReferenceObligation
    -- ^ The Reference Obligation is a financial instrument
    --   that is either issued or guaranteed by the reference
    --   entity. It serves to clarify the precise reference
    --   entity protection is being offered upon, and its
    --   legal position with regard to other related firms
    --   (parents/subsidiaries). Furthermore the Reference
    --   Obligation is ALWAYS deliverable and establishes the
    --   Pari Passu ranking (as the deliverable bonds must
    --   rank equal to the reference obligation). ISDA 2003
    --   Term: Reference Obligation.
  noReferenceObligation : Optional Bool
    -- ^ Used to indicate that there is no Reference
    --   Obligation associated with this Credit Default Swap
    --   and that there will never be one.
  entityType : (FieldWithMeta EntityTypeEnum)
    -- ^ Defines the reference entity types corresponding to a
    --   list of types in the ISDA First to Default
    --   documentation.
    deriving (Eq, Ord, Show)

-- | This type contains all the reference pool items to
--   define the reference entity and reference
--   obligation(s) in the basket.
data ReferencePool = ReferencePool with 
  referencePoolItem : [ReferencePoolItem]
    -- ^ This type contains all the constituent weight and
    --   reference information.
    deriving (Eq, Ord, Show)

-- | This type contains all the constituent weight and
--   reference information.
data ReferencePoolItem = ReferencePoolItem with 
  constituentWeight : Optional ConstituentWeight
    -- ^ Describes the weight of each of the constituents
    --   within the basket. If not provided, it is assumed to
    --   be equal weighted.
  referencePair : ReferencePair
  protectionTermsReference : Optional (ReferenceWithMeta ProtectionTerms)
    -- ^ Reference to the documentation terms applicable to
    --   this item.
  cashSettlementTermsReference : Optional (ReferenceWithMeta CashSettlementTerms)
    -- ^ Reference to the cash settlement terms applicable to
    --   this item.
  physicalSettlementTermsReference : Optional (ReferenceWithMeta PhysicalSettlementTerms)
    -- ^ Reference to the physical settlement terms applicable
    --   to this item.
    deriving (Eq, Ord, Show)

-- | A complex type used to specify the option and
--   convertible bond option strike when expressed in
--   reference to a swap curve.
data ReferenceSwapCurve = ReferenceSwapCurve with 
  swapUnwindValue : SwapCurveValuation
  makeWholeAmount : Optional MakeWholeAmount
    -- ^ Amount to be paid by the buyer of the option if the
    --   option is exercised prior to the Early Call Date.
    --   (The market practice in the convertible bond option
    --   space being that the buyer should be penalised if
    --   he/she exercises the option early on.)
    deriving (Eq, Ord, Show)

-- | Represents a class to allow specification of
--   different type of Regional government collateral.
data RegionalGovernmentIssuerType = RegionalGovernmentIssuerType with 
  sovereignRecourse : Bool
    -- ^ Applies to regional governments, local authorities or
    --   municipals.  True if entity has recourse to sovereign
    --   (e.g. debt guaranteed by government).  False if
    --   entity does not have recourse to sovereign.
    deriving (Eq, Ord, Show)

data RelatedParty = RelatedParty with 
  partyReference : (ReferenceWithMeta Party)
    -- ^ Reference to a party.
  accountReference : Optional (ReferenceWithMeta Account)
    -- ^ Reference to an account.
  role : PartyRoleEnum
    -- ^ The category of the relationship. The related party
    --   performs the role specified in this field for the
    --   base party. For example, if the role is ,Guarantor,
    --   the related party acts as a guarantor for the base
    --   party.
    deriving (Eq, Ord, Show)

-- | A class defining a date (referred to as the derived
--   date) as a relative offset from another date
--   (referred to as the anchor date). If the anchor date
--   is itself an adjustable date then the offset is
--   assumed to be calculated from the adjusted anchor
--   date. A number of different scenarios can be
--   supported, namely; 1) the derived date may simply be
--   a number of calendar periods (days, weeks, months or
--   years) preceding or following the anchor date; 2) the
--   unadjusted derived date may be a number of calendar
--   periods (days, weeks, months or years) preceding or
--   following the anchor date with the resulting
--   unadjusted derived date subject to adjustment in
--   accordance with a specified business day convention,
--   i.e. the derived date must fall on a good business
--   day; 3) the derived date may be a number of business
--   days preceding or following the anchor date. Note
--   that the businessDayConvention specifies any required
--   adjustment to the unadjusted derived date. A negative
--   or positive value in the periodMultiplier indicates
--   whether the unadjusted derived precedes or follows
--   the anchor date. The businessDayConvention should
--   contain a value NONE if the day type element contains
--   a value of Business (since specifying a negative or
--   positive business days offset would already guarantee
--   that the derived date would fall on a good business
--   day in the specified business centers).
data RelativeDateOffset = RelativeDateOffset with 
  periodMultiplier : Int
    -- ^ A time period multiplier, e.g. 1, 2 or 3 etc. A
    --   negative value can be used when specifying an offset
    --   relative to another date, e.g. -2 days.
  period : PeriodEnum
    -- ^ A time period, e.g. a day, week, month or year of the
    --   stream. If the periodMultiplier value is 0 (zero)
    --   then period must contain the value D (day).
  meta : Optional MetaFields
  dayType : Optional DayTypeEnum
    -- ^ In the case of an offset specified as a number of
    --   days, this element defines whether consideration is
    --   given as to whether a day is a good business day or
    --   not. If a day type of business days is specified then
    --   non-business days are ignored when calculating the
    --   offset. The financial business centers to use for
    --   determination of business days are implied by the
    --   context in which this element is used. This element
    --   must only be included when the offset is specified as
    --   a number of days. If the offset is zero days then the
    --   dayType element should not be included.
  businessDayConvention : BusinessDayConventionEnum
    -- ^ The convention for adjusting a date if it would
    --   otherwise fall on a day that is not a business day,
    --   as specified by an ISDA convention (e.g. Following,
    --   Precedent).
  businessCenters : Optional BusinessCenters
  businessCentersReference : Optional (ReferenceWithMeta BusinessCenters)
    -- ^ A pointer style reference to a set of financial
    --   business centers defined elsewhere in the document.
    --   This set of business centers is used to determine
    --   whether a particular day is a business day or not.
  dateRelativeTo : Optional (BasicReferenceWithMeta Date)
    -- ^ Specifies the anchor as an href attribute. The href
    --   attribute value is a pointer style reference to the
    --   element or component elsewhere in the document where
    --   the anchor date is defined.
  adjustedDate : Optional Date
    -- ^ The date once the adjustment has been performed.
    --   (Note that this date may change if the business
    --   center holidays change).
    deriving (Eq, Ord, Show)

-- | A class describing a set of dates defined as relative
--   to another set of dates.
data RelativeDates = RelativeDates with 
  periodMultiplier : Int
    -- ^ A time period multiplier, e.g. 1, 2 or 3 etc. A
    --   negative value can be used when specifying an offset
    --   relative to another date, e.g. -2 days.
  period : PeriodEnum
    -- ^ A time period, e.g. a day, week, month or year of the
    --   stream. If the periodMultiplier value is 0 (zero)
    --   then period must contain the value D (day).
  meta : Optional MetaFields
  dayType : Optional DayTypeEnum
    -- ^ In the case of an offset specified as a number of
    --   days, this element defines whether consideration is
    --   given as to whether a day is a good business day or
    --   not. If a day type of business days is specified then
    --   non-business days are ignored when calculating the
    --   offset. The financial business centers to use for
    --   determination of business days are implied by the
    --   context in which this element is used. This element
    --   must only be included when the offset is specified as
    --   a number of days. If the offset is zero days then the
    --   dayType element should not be included.
  businessDayConvention : BusinessDayConventionEnum
    -- ^ The convention for adjusting a date if it would
    --   otherwise fall on a day that is not a business day,
    --   as specified by an ISDA convention (e.g. Following,
    --   Precedent).
  businessCenters : Optional BusinessCenters
  businessCentersReference : Optional (ReferenceWithMeta BusinessCenters)
    -- ^ A pointer style reference to a set of financial
    --   business centers defined elsewhere in the document.
    --   This set of business centers is used to determine
    --   whether a particular day is a business day or not.
  dateRelativeTo : Optional (BasicReferenceWithMeta Date)
    -- ^ Specifies the anchor as an href attribute. The href
    --   attribute value is a pointer style reference to the
    --   element or component elsewhere in the document where
    --   the anchor date is defined.
  adjustedDate : Optional Date
    -- ^ The date once the adjustment has been performed.
    --   (Note that this date may change if the business
    --   center holidays change).
  periodSkip : Optional Int
    -- ^ The number of periods in the referenced date schedule
    --   that are between each date in the relative date
    --   schedule. Thus a skip of 2 would mean that dates are
    --   relative to every second date in the referenced
    --   schedule. If present this should have a value greater
    --   than 1.
  scheduleBounds : Optional DateRange
    -- ^ The first and last dates of a schedule. This can be
    --   used to restrict the range of values in a reference
    --   series of dates.
    deriving (Eq, Ord, Show)

data Representations = Representations with 
    deriving (Eq, Ord, Show)

-- | Defines the reset value or fixing value produced in
--   cashflow calculations, during the life-cycle of a
--   financial instrument. The reset process defined in
--   Create_Reset function joins product definition
--   details with observations to compute the reset value.
data Reset = Reset with 
  resetValue : Price
    -- ^ Specifies the reset or fixing value. The fixing value
    --   could be a cash price, interest rate, or other value.
  resetDate : Date
    -- ^ Specifies the date on which the reset occurred.
  rateRecordDate : Optional Date
    -- ^ Specifies the 'Rate Record Day' for a
    --   Fallback rate.  Fallback rate fixing processes
    --   typically set the fixing rate in arrears, i.e., the
    --   Fallback Rate corresponding to a Rate Record Date is
    --   set at the end of the interest accural period.  When
    --   this applies, Reset->resetDate occurs at the end
    --   of the interest period, and the
    --   Reset->rateRecordDate occurs near the start of the
    --   interest period.  The Reset->rateRecordDate and
    --   Reset->observations->observationIdentifier->observationDate
    --   will differ if a Fallback rate is unavailable on the
    --   Rate Record Date, and the latest previous available
    --   rate is used as the observation.
  observations : [ReferenceWithMeta Observation]
    -- ^ Represents an audit of the observations used to
    --   produce the reset value. If multiple observations
    --   were necessary to produce the reset value, the
    --   aggregation method should be defined on the payout.
  averagingMethodology : Optional AveragingCalculation
    -- ^ Identifies the aggregation method to use in the case
    --   where multiple observations are used to compute the
    --   reset value and the method is not defined in a
    --   payout.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A data defining:  the parameters used to generate the
--   reset dates schedule and associated fixing dates. The
--   reset dates are the dates on which the new index
--   value (which is observed on the fixing date) is
--   applied for each period and on which the interest
--   rate hence begins to accrue.
data ResetDates = ResetDates with 
  calculationPeriodDatesReference : Optional (ReferenceWithMeta CalculationPeriodDates)
    -- ^ A pointer style reference to the associated
    --   calculation period dates component defined elsewhere
    --   in the document.
  resetRelativeTo : Optional ResetRelativeToEnum
    -- ^ Specifies whether the reset dates are determined with
    --   respect to each adjusted calculation period start
    --   date or adjusted calculation period end date. If the
    --   reset frequency is specified as daily this element
    --   must not be included.
  initialFixingDate : Optional InitialFixingDate
    -- ^ The initial fixing date.
  fixingDates : Optional RelativeDateOffset
    -- ^ The fixing dates are the dates on which the index
    --   values are observed. The fixing dates are specified
    --   by reference to the reset date through business days
    --   offset and an associated set of financial business
    --   centers. Normally these offset calculation rules will
    --   be those specified in the ISDA definition for the
    --   relevant floating rate index (ISDA's Floating
    --   Rate Option). However, non-standard offset
    --   calculation rules may apply for a trade if mutually
    --   agreed by the principal parties to the transaction.
  finalFixingDate : Optional AdjustableDate
    -- ^ This attribute is not part of the FpML ResetDate, and
    --   has been added as part of the CDM to support the
    --   credit derivatives final fixing date.
  rateCutOffDaysOffset : Optional Offset
    -- ^ Specifies the number of business days before the
    --   period end date when the rate cut-off date is assumed
    --   to apply. The financial business centers associated
    --   with determining the rate cut-off date are those
    --   specified in the reset dates adjustments. The rate
    --   cut-off number of days must be a negative integer (a
    --   value of zero would imply no rate cut off applies in
    --   which case the rateCutOffDaysOffset element should
    --   not be included). The relevant rate for each reset
    --   date in the period from, and including, a rate
    --   cut-off date to, but excluding, the next applicable
    --   period end date (or, in the case of the last
    --   calculation period, the termination date) will
    --   (solely for purposes of calculating the floating
    --   amount payable on the next applicable payment date)
    --   be deemed to be the relevant rate in effect on that
    --   rate cut-off date. For example, if rate cut-off days
    --   for a daily averaging deal is -2 business days, then
    --   the refix rate applied on (period end date - 2 days)
    --   will also be applied as the reset on (period end date
    --   - 1 day), i.e. the actual number of reset dates
    --   remains the same but from the rate cut-off date until
    --   the period end date, the same refix rate is applied.
    --   Note that in the case of several calculation periods
    --   contributing to a single payment, the rate cut-off is
    --   assumed only to apply to the final calculation period
    --   contributing to that payment. The day type associated
    --   with the offset must imply a business days offset.
  resetFrequency : Optional ResetFrequency
    -- ^ The frequency at which the reset dates occur. In the
    --   case of a weekly reset frequency, also specifies the
    --   day of the week that the reset occurs. If the reset
    --   frequency is greater than the calculation period
    --   frequency then this implies that more than one reset
    --   is established for each calculation period and some
    --   form of rate averaging is applicable.
  resetDatesAdjustments : Optional BusinessDayAdjustments
    -- ^ The definition of the business day convention and
    --   financial business centers used for adjusting the
    --   reset date if it would otherwise fall on a day that
    --   is not a business day in the specified business
    --   center.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A class defining the reset frequency. In the case of
--   a weekly reset, also specifies the day of the week
--   that the reset occurs. If the reset frequency is
--   greater than the calculation period frequency the
--   this implies that more or more reset dates is
--   established for each calculation period and some form
--   of rate averaging is applicable. The specific
--   averaging method of calculation is specified in
--   FloatingRateCalculation. In case the reset frequency
--   is of value T (term), the period is defined by the
--   swap/swapStream/calculationPerioDates/effectiveDate
--   and the
--   swap/swapStream/calculationPerioDates/terminationDate.
data ResetFrequency = ResetFrequency with 
  periodMultiplier : Int
    -- ^ A time period multiplier, e.g. 1, 2, or 3. If the
    --   period value is T (Term) then period multiplier must
    --   contain the value 1.
  period : PeriodExtendedEnum
    -- ^ A time period, e.g. a day, week, month, year or term
    --   of the stream.
  meta : Optional MetaFields
  weeklyRollConvention : Optional WeeklyRollConventionEnum
    -- ^ The day of the week on which a weekly reset date
    --   occurs. This element must be included if the reset
    --   frequency is defined as weekly and not otherwise.
    deriving (Eq, Ord, Show)

-- | Defines the information needed to create a Reset
--   Business Event. 
data ResetInstruction = ResetInstruction with 
  payout : [ReferenceWithMeta Payout]
  rateRecordDate : Optional Date
    -- ^ Specifies the 'Rate Record Day' for a
    --   Fallback rate.  Fallback rate fixing processes
    --   typically set the fixing rate in arrears, i.e., the
    --   Fallback Rate corresponding to a Rate Record Date is
    --   set at the end of the interest accural period.  When
    --   this applies, Reset->resetDate occurs at the end
    --   of the interest period, and the
    --   Reset->rateRecordDate occurs near the start of the
    --   interest period.  The Reset->rateRecordDate and
    --   Reset->observations->observationIdentifier->observationDate
    --   will differ if a Fallback rate is unavailable on the
    --   Rate Record Date, and the latest previous available
    --   rate is used as the observation.
  resetDate : Date
    -- ^ Specifies the date on which the reset is occuring.
    deriving (Eq, Ord, Show)

-- | Generic class to specify the quantity for different
--   payout legs in a contractual product, when that
--   quantity can vary across payout legs or across time.
--   A resolvable quantity can always be resolved into a
--   single quantity from the quantity notation which has
--   a corresponding asset identifier. In addition to the
--   base case, where quantity is directly specified as a
--   number as part of the quantity notation, the other
--   use cases are: (i) quantity based on some pre-defined
--   schedule (eg amortising notional), (ii) quantity
--   based on some pre-defined events (eg resetting
--   cross-currency notional), or quantity set as
--   reference to another quantity (eg equity notional as
--   no. securities x price).
data ResolvablePriceQuantity = ResolvablePriceQuantity with 
  resolvedQuantity : Optional Quantity
    -- ^ A product's quantity as a single, non-negative
    --   amount.  When specified as part of a product
    --   definition, this quantity attribute would not be set.
    --   Instead it is specified on the quantity notation
    --   along with an asset identifier matching this
    --   payout's asset identifier.  This allows the
    --   quantity to be resolved for a payout leg, which can
    --   then be specified here for convenience during data
    --   processing.  There needs to be at least one
    --   resolvable quantity across payout legs of a product
    --   to define an anchor that other payout quantities can
    --   refer to.  This attribute is ignored when mapping
    --   existing FpML messages.
  quantitySchedule : Optional (ReferenceWithMeta NonNegativeQuantitySchedule)
    -- ^ A payout's quantity specified as a schedule,
    --   which may also contain a single value if that
    --   quantity is constant. There can only be a single
    --   quantity schedule applicable to a payout: e.g. the
    --   notional for an interest rate leg. The quantity must
    --   be specified outside of the payout in a PriceQuantity
    --   object and only referenced inside the payout using an
    --   address.
  quantityReference : Optional (ReferenceWithMeta ResolvablePriceQuantity)
    -- ^ Reference quantity when resolvable quantity is
    --   defined as relative to another (resolvable) quantity.
    --   A resolvable quantity needs to contain either an
    --   absolute quantity or a reference to another
    --   (resolvable) quantity. This requirement is captured
    --   by a choice rule on the class.
  quantityMultiplier : Optional QuantityMultiplier
    -- ^ Quantity multiplier is specified on top of a
    --   reference quantity and is used as a multiplying
    --   factor when resolving the quantity. A quantity
    --   multiplier can only exist when the resolvable
    --   quantity specifies a reference quantity.
  reset : Optional Bool
    -- ^ Whether the quantity is resettable
  futureValueNotional : Optional FutureValueAmount
    -- ^ The future value notional is specific to BRL CDI
    --   swaps, and is specified alongside the notional
    --   amount. The value is calculated as follows: Future
    --   Value Notional = Notional Amount * (1 + Fixed Rate) ^
    --   (Fixed Rate Day Count Fraction). The currency should
    --   always match that expressed in the notional schedule.
    --   The value date should match the adjusted termination
    --   date.
  priceSchedule : [ReferenceWithMeta PriceSchedule]
    -- ^ A payout's price specified as a schedule, which
    --   may also contain a single value if that price is
    --   constant. There may be multiple prices specified for
    --   a single payout: e.g. a floating interest rate leg
    --   may specify a spread, a cap and/or floor and a
    --   multiplier. The price must be specified outside of
    --   the payout in a PriceQuantity object and only
    --   referenced inside the payout using an address.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | Describes the resource that contains the media
--   representation of a business event (i.e used for
--   stating the Publicly Available Information). For
--   example, can describe a file or a URL that represents
--   the event. This type is an extended version of a type
--   defined by RIXML (www.rixml.org).  Rosetta restricts
--   the FpML implementation by not providing the ability
--   to associated a document in hexadecimalBinary or
--   base64Binary until such time that actual use cases
--   will come up.
data Resource = Resource with 
  resourceId : (FieldWithMeta Text)
    -- ^ The unique identifier of the resource within the
    --   event. FpML specifies this element of type
    --   resourceIdScheme but with no specified value.
  resourceType : Optional (FieldWithMeta ResourceTypeEnum)
    -- ^ A description of the type of the resource, e.g. a
    --   confirmation.
  language : Optional (FieldWithMeta Text)
    -- ^ Indicates the language of the resource, described
    --   using the ISO 639-2/T Code.
  sizeInBytes : Optional Decimal
    -- ^ Indicates the size of the resource in bytes. It could
    --   be used by the end user to estimate the download time
    --   and storage needs.
  length : Optional ResourceLength
    -- ^ Indicates the length of the resource. For example, if
    --   the resource were a PDF file, the length would be in
    --   pages.
  mimeType : Optional (FieldWithMeta Text)
    -- ^ Indicates the type of media used to store the
    --   content. mimeType is used to determine the software
    --   product(s) that can read the content. MIME Types are
    --   described in RFC 2046.
  name : Optional Text
    -- ^ The name of the resource.  It is specified as a
    --   NormalizedString in FpML.
  comments : Optional Text
    -- ^ Any additional comments that are deemed necessary.
    --   For example, which software version is required to
    --   open the document? Or, how does this resource relate
    --   to the others for this event?
  string : Optional Text
    -- ^ Provides extra information as string. In case the
    --   extra information is in XML format, a CDATA section
    --   must be placed around the source message to prevent
    --   its interpretation as XML content.
  url : Optional Text
    -- ^ Indicates where the resource can be found, as a URL
    --   that references the information on a web server
    --   accessible to the message recipient.
    deriving (Eq, Ord, Show)

-- | A class to indicate the length of the resource.
data ResourceLength = ResourceLength with 
  lengthUnit : LengthUnitEnum
    -- ^ The length unit of the resource. For example, pages
    --   (pdf, text documents) or time (audio, video files).
  lengthValue : Decimal
    -- ^ The length value of the resource.
    deriving (Eq, Ord, Show)

data Restructuring = Restructuring with 
  applicable : Bool
    -- ^ Indicates whether the restructuring provision is
    --   applicable.
  restructuringType : Optional (FieldWithMeta RestructuringEnum)
    -- ^ Specifies the type of restructuring that is
    --   applicable.
  multipleHolderObligation : Optional Bool
    -- ^ In relation to a restructuring credit event, unless
    --   multiple holder obligation is not specified
    --   restructurings are limited to multiple holder
    --   obligations. A multiple holder obligation means an
    --   obligation that is held by more than three holders
    --   that are not affiliates of each other and where at
    --   least two thirds of the holders must agree to the
    --   event that constitutes the restructuring credit
    --   event. ISDA 2003 Term: Multiple Holder Obligation.
  multipleCreditEventNotices : Optional Bool
    -- ^ Presence of this element and value set to
    --   'true' indicates that Section 3.9 of the 2003
    --   Credit Derivatives Definitions shall apply. Absence
    --   of this element indicates that Section 3.9 shall not
    --   apply. NOTE: Not allowed under ISDA Credit 1999.
    deriving (Eq, Ord, Show)

-- | A class to specify the application of Interest Amount
--   with respect the Return Amount.
data ReturnAmount = ReturnAmount with 
  includesDefaultLanguage : Optional Bool
    -- ^ Default language is included when True, and excluded
    --   when False.
  customElection : Optional Text
    -- ^ Custom election that might be specified by the
    --   parties to the agreement.
    deriving (Eq, Ord, Show)

-- | Specifies the information required to create the
--   return of a Security Finance Transaction.
data ReturnInstruction = ReturnInstruction with 
  quantity : [Quantity]
    -- ^ Specifies the quantity of shares and cash to be
    --   returned in a partial return event.
    deriving (Eq, Ord, Show)

-- | Specifies the type of return of a performance payout.
data ReturnTerms = ReturnTerms with 
  priceReturnTerms : Optional PriceReturnTerms
    -- ^ Return terms based upon the underlier's observed
    --   price.
  dividendReturnTerms : Optional DividendReturnTerms
    -- ^ Return terms based upon dividend payments associated
    --   to the underlier.
  varianceReturnTerms : Optional VarianceReturnTerms
    -- ^ Return terms based upon the observed variance of the
    --   underlier's price.
  volatilityReturnTerms : Optional VolatilityReturnTerms
    -- ^ Return terms based upon the observed volatility of
    --   the underlier's price.
  correlationReturnTerms : Optional CorrelationReturnTerms
    -- ^ Return terms based upon the observed correlation
    --   between the components of the underlying basket.
    deriving (Eq, Ord, Show)

-- | Contains all common elements in variance, volatility
--   and correlation return Terms.
data ReturnTermsBase = ReturnTermsBase with 
  valuationTerms : ValuationTerms
    -- ^ Contains all non-date valuation information.
  annualizationFactor : Optional Int
    -- ^ This specifies the numerator of an annualization
    --   factor. Frequently this number is equal to the number
    --   of observations of prices in a year e.g. 252.
  dividendApplicability : Optional DividendApplicability
    -- ^ The parameters which define whether dividends are
    --   applicable
  equityUnderlierProvisions : Optional EquityUnderlierProvisions
    -- ^ Contains Equity Underlyer provisions regarding
    --   jurisdiction and fallbacks.
  sharePriceDividendAdjustment : Optional Bool
    -- ^ Indicates whether the price of shares is adjusted for
    --   dividends or not.
  expectedN : Int
    -- ^ Expected number of trading days.
  initialLevel : Optional Decimal
    -- ^ Contract will strike off this initial level.
    --   Providing just the initialLevel without
    --   initialLevelSource, infers that this is
    --   AgreedInitialPrice - a specified Initial Index Level.
  initialLevelSource : Optional DeterminationMethodEnum
    -- ^ In this context, this is AgreedInitialPrice - a
    --   specified Initial Index Level.
  meanAdjustment : Optional Bool
    -- ^ Specifies whether Mean Adjustment is applicable or
    --   not in the calculation of the Realized Volatility,
    --   Variance or Correlation
  performance : Optional Text
    -- ^ Performance calculation, in accordance with Part 1
    --   Section 12 of the 2018 ISDA CDM Equity Confirmation
    --   for Security Equity Swap, Para 75. 'Equity
    --   Performance'. Cumulative performance is used as a
    --   notional multiplier factor on both legs of an Equity
    --   Swap.
    deriving (Eq, Ord, Show)

-- | Used in conjunction with an exchange-based pricing
--   source. Identifies a way in which the futures
--   contracts referenced will roll between periods. 
data RollFeature = RollFeature with 
  rollSourceCalendar : Optional RollSourceCalendarEnum
    -- ^ Used in conjunction with an exchange-based pricing
    --   source. Identifies a date source calendar from which
    --   the pricing dates and thus roll to the next contract
    --   will be based off (e.g. pricing is based on the NYMEX
    --   WTI First Nearby Futures Contract, if Future is
    --   chosen, the pricing will roll to the next futures
    --   contract on expiration, if ListedOption is chosen,
    --   the pricing will roll to the next futures contract on
    --   the Option expiration date which is three business
    --   days before the expiration of the NYMEX WTI futures
    --   contract.) Omitting this element will result in the
    --   default behavior expected with the pricing source
    --   described within the commodity element.
  deliveryDateRollConvention : Optional Offset
    -- ^ Specifies, for a Commodity Transaction that
    --   references a delivery date for a listed future, the
    --   day on which the specified future will roll to the
    --   next nearby month prior to the expiration of the
    --   referenced future. If the future will not roll at all
    --   - i.e. the price will be taken from the expiring
    --   contract, 0 should be specified here. If the future
    --   will roll to the next nearby on the last trading day
    --   - i.e. the price will be taken from the next nearby
    --   on the last trading day, then 1 should be specified
    --   and so on.
    deriving (Eq, Ord, Show)

-- | Defines rounding rules and precision to be used in
--   the rounding of a number.
data Rounding = Rounding with 
  roundingDirection : RoundingDirectionEnum
    -- ^ Specifies the rounding rounding rule as up, down, or
    --   nearest.
  precision : Optional Int
    -- ^ Specifies the rounding precision in terms of a number
    --   of decimal places when the number is evaluated in
    --   decimal form (not percentage), e.g. 0.09876543
    --   rounded to the nearest 5 decimal places is 
    --   0.0987654.
    deriving (Eq, Ord, Show)

-- | A class defining a schedule of rates or amounts in
--   terms of an initial value and then a series of step
--   date and value pairs. On each step date the rate or
--   amount changes to the new step value. The series of
--   step date and value pairs are optional. If not
--   specified, this implies that the initial value
--   remains unchanged over time.
data Schedule = Schedule with 
  value : Decimal
    -- ^ The initial rate or amount, as the case may be. An
    --   initial rate of 5% would be represented as 0.05.
  datedValue : [DatedValue]
    -- ^ The schedule of step date and value pairs. On each
    --   step date the associated step value becomes
    --   effective. A list of steps may be ordered in the
    --   document by ascending step date. An FpML document
    --   containing an unordered list of steps is still
    --   regarded as a conformant document.
    deriving (Eq, Ord, Show)

-- | A class that defines the period of a schedule. The
--   period contains a set of start and end dates,
--   quantities, fixing, and pricing data.
data SchedulePeriod = SchedulePeriod with 
  calculationPeriod : DateRange
    -- ^ Period for which the payment is generated.
  paymentDate : Date
    -- ^ Adjusted payment date.
  fixingPeriod : DateRange
    -- ^ Period over which the underlying price is observed.
  deliveryPeriod : Optional CalculationScheduleDeliveryPeriods
    -- ^ Period and time profile over which the delivery takes
    --   place.
    deriving (Eq, Ord, Show)

data ScheduledTransfer = ScheduledTransfer with 
  transferType : ScheduledTransferEnum
    -- ^ Specifies a transfer created from a scheduled or
    --   contingent event on a contract, e.g. Exercise,
    --   Performance, Credit Event
  corporateActionTransferType : Optional CorporateActionTypeEnum
    deriving (Eq, Ord, Show)

data SchmeNm = SchmeNm with 
  prtry : Text
    deriving (Eq, Ord, Show)

-- | Identifies a security by referencing an identifier
--   and by specifying the sector.
data Security = Security with 
  identifier : [AssetIdentifier]
    -- ^ Asset Identifiers are used to uniquely identify an
    --   Asset, using a specified Asset Identifier Type.
  taxonomy : [Taxonomy]
    -- ^ Defines the taxonomy of an object by combining a
    --   taxonomy source (i.e. the rules to classify the
    --   object) and a value (i.e. the output of those rules
    --   on the object.
  isExchangeListed : Optional Bool
    -- ^ Defines whether the Asset is listed on a public
    --   exchange.
  exchange : Optional LegalEntity
    -- ^ If the Asset is listed, defines the public exchange
    --   of the listing.
  relatedExchange : [LegalEntity]
    -- ^ Provides the related Exchanges, if applicable.
  instrumentType : InstrumentTypeEnum
    -- ^ Identifies the type of an instrument using an
    --   enumerated list.
  debtType : Optional DebtType
    -- ^ Identifies the type of debt and selected debt
    --   economics.
  equityType : Optional EquityTypeEnum
    -- ^ Identifies the type of equity.
  fundType : Optional FundProductTypeEnum
    -- ^ Identifies the type of fund.
    deriving (Eq, Ord, Show)

-- | The set of elections which specify a Security
--   Agremeent
data SecurityAgreementElections = SecurityAgreementElections with 
    deriving (Eq, Ord, Show)

-- | Specifies the information required for inclusion in a
--   securities lending billing invoice.
data SecurityLendingInvoice = SecurityLendingInvoice with 
  sendingParty : Party
    -- ^ The party issuing the invoice
  receivingParty : Party
    -- ^ The party receiving the invoice
  billingStartDate : Date
    -- ^ The starting date of the period described by this
    --   invoice
  billingEndDate : Date
    -- ^ The ending date of the period described by this
    --   invoice
  billingRecord : [BillingRecord]
    -- ^ The billing records contained within the invoice
  billingSummary : [BillingSummary]
    -- ^ The billing summaries contained within the invoice
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A locate is an approval from a broker that needs to
--   be obtained prior to effecting a short sale in an
--   equity security. Similar to security availability, a
--   borrower can request a single or multiple securities,
--   but at least one must be requested.
data SecurityLocate = SecurityLocate with 
  availableInventoryType : AvailableInventoryTypeEnum
    -- ^ Defines the purpose of this inventory.
  messageInformation : Optional MessageInformation
    -- ^ Allows details related to the availability messaging
    --   use case to be defined
  party : [Party]
    -- ^ Defines all parties involved for the list of
    --   inventory records in this set of inventory. For
    --   example, when used to describe securities lending
    --   availability, this could hold the sender of the
    --   availability, the intended recipient, the beneficial
    --   owner(s), the lender (which may differ from the
    --   sender as the lender may have the same piece of
    --   availability going through multiple agents), an agent
    --   or a venue.
  partyRole : [PartyRole]
    -- ^ Defines the role(s) that party(ies) may have in
    --   relation to the inventory.
  availableInventoryRecord : [AvailableInventoryRecord]
    -- ^ An array holding the list of inventory being
    --   described. Each element in the inventoryRecord array
    --   represents an individual piece of inventory i.e. a
    --   security.
    deriving (Eq, Ord, Show)

data Sellr = Sellr with 
  acctOwnr : AcctOwnr
    deriving (Eq, Ord, Show)

-- | A class to specify the Relevant Settled Entity
--   Matrix.
data SettledEntityMatrix = SettledEntityMatrix with 
  matrixSource : (FieldWithMeta SettledEntityMatrixSourceEnum)
    -- ^ Relevant settled entity matrix source.
  publicationDate : Optional Date
    -- ^ Specifies the publication date of the applicable
    --   version of the matrix. When this element is omitted,
    --   the Standard Terms Supplement defines rules for which
    --   version of the matrix is applicable.
    deriving (Eq, Ord, Show)

-- | A base class to be extended by the SettlementTerms
--   class.
data SettlementBase = SettlementBase with 
  settlementType : SettlementTypeEnum
    -- ^ Whether the settlement will be cash, physical, by
    --   election, ...
  transferSettlementType : Optional TransferSettlementEnum
    -- ^ The qualification as to how the transfer will settle,
    --   e.g. a DvP settlement.
  settlementCurrency : Optional (FieldWithMeta Text)
    -- ^ The settlement currency is to be specified when the
    --   Settlement Amount cannot be known in advance. The
    --   list of valid currencies is not presently positioned
    --   as an enumeration as part of the CDM because that
    --   scope is limited to the values specified by ISDA and
    --   FpML. As a result, implementers have to make
    --   reference to the relevant standard, such as the ISO
    --   4217 standard for currency codes.
  settlementDate : Optional SettlementDate
    -- ^ The date on which the settlement amount will be paid,
    --   subject to adjustment in accordance with any
    --   applicable business day convention. This component
    --   would not be present for a mandatory early
    --   termination provision where the cash settlement
    --   payment date is the mandatory early termination date.
  settlementCentre : Optional SettlementCentreEnum
    -- ^ Optional settlement centre as an enumerated list:
    --   Euroclear, Clearstream.
  settlementProvision : Optional SettlementProvision
    -- ^ Optionally defines the parameters that regulate a
    --   settlement.
  standardSettlementStyle : Optional StandardSettlementStyleEnum
    -- ^ Settlement Style.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A data defining the settlement date(s) for cash or
--   physical settlement as either a set of explicit
--   dates, together with applicable adjustments, or as a
--   date relative to some other (anchor) date, or as any
--   date in a range of contiguous business days. This
--   data type provides a level of abstraction on top of
--   the different legacy methods used to specify a
--   settlement / payment date, which vary across product
--   types, asset classes and delivery types.
data SettlementDate = SettlementDate with 
  adjustableOrRelativeDate : Optional AdjustableOrAdjustedOrRelativeDate
    -- ^ A single settlement date subject to adjustment or
    --   specified as relative to another date (e.g. the trade
    --   date). This attribute was formerly part of
    --   'SettlementTerms', which is now being
    --   harmonised to include a common
    --   'SettlementDate', as inherited from
    --   'SettlementBase'.
  valueDate : Optional Date
    -- ^ The settlement date for a forward settling product.
    --   For Foreign Exchange contracts, this represents a
    --   common settlement date between both currency legs. To
    --   specify different settlement dates for each currency
    --   leg, see the ForeignExchange class. This attribute
    --   was formerly part of 'SettlementTerms', which
    --   is now being harmonised to include a common
    --   'SettlementDate', as inherited from
    --   'SettlementBase'.
  adjustableDates : Optional AdjustableDates
    -- ^ A series of dates that shall be subject to adjustment
    --   if they would otherwise fall on a day that is not a
    --   business day in the specified business centers,
    --   together with the convention for adjusting the date.
    --   This attributes was formerly part of
    --   'CashSettlementPaymentDate' as included into
    --   'OptionCashSettlement' (which is now merged
    --   into a unique 'CashSettlementTerms' data
    --   type.
  businessDateRange : Optional BusinessDateRange
    -- ^ A range of contiguous business days. This attribute
    --   is meant to be merged with the
    --   'settlementDate' at some future point once we
    --   refactor 'Date' to use a single complex type
    --   across the model. This attributes was formerly part
    --   of 'CashSettlementPaymentDate', as included
    --   into 'OptionCashSettlement' (which is now
    --   merged into a unique 'CashSettlementTerms'
    --   data type.
  cashSettlementBusinessDays : Optional Int
    -- ^ The number of business days used in the determination
    --   of the cash settlement payment date. If a cash
    --   settlement amount is specified, the cash settlement
    --   payment date will be this number of business days
    --   following the calculation of the final price. If a
    --   cash settlement amount is not specified, the cash
    --   settlement payment date will be this number of
    --   business days after all conditions to settlement are
    --   satisfied. ISDA 2003 Term: Cash Settlement Date. This
    --   attribute was formerly part of
    --   'CashSettlementTerms' as used for credit
    --   event settlement, which now includes a common
    --   'SettlementDate' attribute.
  paymentDelay : Optional Bool
    -- ^ Applicable to CDS on MBS to specify whether payment
    --   delays are applicable to the fixed Amount. RMBS
    --   typically have a payment delay of 5 days between the
    --   coupon date of the reference obligation and the
    --   payment date of the synthetic swap. CMBS do not, on
    --   the other hand, with both payment dates being on the
    --   25th of each month.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | Represents a forward settling payout. The underlier
--   attribute captures the underlying payout, which is
--   settled according to the settlementTerms attribute
--   (which is part of PayoutBase). Both FX Spot and FX
--   Forward should use this component.
data SettlementPayout = SettlementPayout with 
  payerReceiver : PayerReceiver
    -- ^ Canonical representation of the payer and receiver
    --   parties applicable to each payout leg.
  priceQuantity : Optional ResolvablePriceQuantity
    -- ^ Each payout leg must implement the quantity concept
    --   as a 'resolvable' type, which allows for
    --   different payout legs to be linked to each other
    --   (e.g. in the case of cross-curreny products).
  principalPayment : Optional PrincipalPayments
    -- ^ The specification of the principal exchange. Optional
    --   as only applicable in the case of cross-currency or
    --   zero-coupon swaps with a final payment.
  settlementTerms : Optional SettlementTerms
    -- ^ Each payout leg must specifies its settlement terms,
    --   including the delivery type (i.e. cash vs physical,
    --   and their respective terms), the transfer type (DvP
    --   etc.) and settlement date, if any.
  underlier : Underlier
    -- ^ The underlying financial product that will be
    --   physically or cash settled, which can be of any type,
    --   eg an asset such as cash or a security, or the cash
    --   settlement of an index rate.
  deliveryTerm : Optional Text
    -- ^ Also called contract month or delivery month.
    --   However, it's not always a month. It is usually
    --   expressed using a code, e.g. Z23 would be the Dec
    --   2023 contract, (Z = December). For crude oil, the
    --   corresponding contract might be called CLZ23.
  delivery : Optional AssetDeliveryInformation
    -- ^ Contains the information relative to the delivery of
    --   the asset.
  schedule : Optional CalculationSchedule
    -- ^ Allows the full representation of a payout by
    --   defining a set of schedule periods. It supports
    --   standard schedule customization by expressing all the
    --   dates, quantities, and pricing data in a
    --   non-parametric way.
  fixedPrice : [ReferenceWithMeta PriceSchedule]
    -- ^ Specifies the price of the settlement. The multiple
    --   cardinality is aligned to the one of the
    --   PriceQuantity->price that this price is
    --   referencing.
    deriving (Eq, Ord, Show)

-- | Defines parameters that regulate a settlement, for
--   instance whether this settlement should be netted
--   with other ones or broken-down into smaller amounts.
data SettlementProvision = SettlementProvision with 
  shapingProvisions : Optional ShapingProvision
    -- ^ Defines the parameters that are necessary to
    --   'shape' a settlement, i.e. break it down into
    --   smaller amounts.
    deriving (Eq, Ord, Show)

-- | Defines the settlement rate option to use for fixing
--   in case of cash settlement. Currently only applicable
--   to foreign exchange fixing in case of cross-currency
--   settlement.
data SettlementRateOption = SettlementRateOption with 
  settlementRateOption : (FieldWithMeta SettlementRateOptionEnum)
    -- ^ The rate source for the conversion to the settlement
    --   currency. This source is specified through a scheme
    --   that reflects the terms of the Annex A to the 1998 FX
    --   and Currency Option Definitions.
  priceSourceDisruption : Optional PriceSourceDisruption
    -- ^ An attribute defining the parameters to get a new
    --   quote when a settlement rate option is disrupted.
    deriving (Eq, Ord, Show)

-- | Specifies the settlement terms, which can either be
--   cash, physical, or fx-based cash-settlement. This
--   class can be used for the settlement of options and
--   forwards, cash transactions (e.g. securities or
--   foreign exchange), or in case of credit event.
data SettlementTerms = SettlementTerms with 
  settlementType : SettlementTypeEnum
    -- ^ Whether the settlement will be cash, physical, by
    --   election, ...
  transferSettlementType : Optional TransferSettlementEnum
    -- ^ The qualification as to how the transfer will settle,
    --   e.g. a DvP settlement.
  settlementCurrency : Optional (FieldWithMeta Text)
    -- ^ The settlement currency is to be specified when the
    --   Settlement Amount cannot be known in advance. The
    --   list of valid currencies is not presently positioned
    --   as an enumeration as part of the CDM because that
    --   scope is limited to the values specified by ISDA and
    --   FpML. As a result, implementers have to make
    --   reference to the relevant standard, such as the ISO
    --   4217 standard for currency codes.
  settlementDate : Optional SettlementDate
    -- ^ The date on which the settlement amount will be paid,
    --   subject to adjustment in accordance with any
    --   applicable business day convention. This component
    --   would not be present for a mandatory early
    --   termination provision where the cash settlement
    --   payment date is the mandatory early termination date.
  settlementCentre : Optional SettlementCentreEnum
    -- ^ Optional settlement centre as an enumerated list:
    --   Euroclear, Clearstream.
  settlementProvision : Optional SettlementProvision
    -- ^ Optionally defines the parameters that regulate a
    --   settlement.
  standardSettlementStyle : Optional StandardSettlementStyleEnum
    -- ^ Settlement Style.
  meta : Optional MetaFields
  cashSettlementTerms : [CashSettlementTerms]
    -- ^ Specifies the parameters associated with the cash
    --   settlement procedure.
  physicalSettlementTerms : Optional PhysicalSettlementTerms
    -- ^ Specifies the physical settlement terms which apply
    --   to the transaction.
    deriving (Eq, Ord, Show)

-- | Defines the applicable settlement limits that may
--   require a settlement to be 'shaped', i.e.
--   broken-down into smaller amounts.
data ShapingProvision = ShapingProvision with 
  shapeSchedule : [Money]
    -- ^ Defines applicable settlement limits in each
    --   currency.
    deriving (Eq, Ord, Show)

-- | A class to specify the number of business days after
--   satisfaction of all conditions to settlement.
data SingleValuationDate = SingleValuationDate with 
  businessDays : Optional Int
    -- ^ A number of business days. Its precise meaning is
    --   dependant on the context in which this element is
    --   used. ISDA 2003 Term: Business Day.
    deriving (Eq, Ord, Show)

data Sngl = Sngl with 
  isin : Text
  indx : Indx
    deriving (Eq, Ord, Show)

-- | Represents a class to allow specification of
--   different types of special purpose vehicle (SPV)
--   collateral.
data SpecialPurposeVehicleIssuerType = SpecialPurposeVehicleIssuerType with 
  creditRisk : Optional CreditRiskEnum
    -- ^ Indicates tranched or untranched credit risk.
    deriving (Eq, Ord, Show)

data SpecifiedCurrency = SpecifiedCurrency with 
  applicable : Bool
    -- ^ Indicates whether the specified currency provision is
    --   applicable.
  currency : Optional (FieldWithMeta Text)
    -- ^ The currency in which the specified currency is
    --   denominated. The list of valid currencies is not
    --   presently positioned as an enumeration as part of the
    --   CDM because that scope is limited to the values
    --   specified by ISDA and FpML. As a result, implementers
    --   have to make reference to the relevant standard, such
    --   as the ISO 4217 standard for currency codes.
    deriving (Eq, Ord, Show)

-- | Specifies instructions for a split, consisting of a
--   breakdown of instructions to be applied to each
--   branch of the split. This instruction can be used to
--   duplicate a trade, as in a clearing scenario, or to
--   split a trade into smaller quantities (in which case
--   each breakdown instruction needs to include a
--   quantity change), as in an allocation.
data SplitInstruction = SplitInstruction with 
  breakdown : [PrimitiveInstruction]
    -- ^ Each split breakdown specifies the set of primitive
    --   instructions to be applied to a single branch of that
    --   split. N split breakdowns result in N output trades,
    --   which include the original trade. Instructions for
    --   how to handle the original trade (e.g. if it must be
    --   closed) must be specified in one of the breakdowns.
    deriving (Eq, Ord, Show)

-- | Adds an optional spread type element to the Schedule
--   to identify a long or short spread value.
data SpreadSchedule = SpreadSchedule with 
  price : (ReferenceWithMeta PriceSchedule)
    -- ^ The initial rate. An initial rate of 5% would be
    --   represented as 0.05.
  spreadScheduleType : Optional (FieldWithMeta SpreadScheduleTypeEnum)
    -- ^ An element which purpose is to identify a long or
    --   short spread value.
    deriving (Eq, Ord, Show)

data StandardizedSchedule = StandardizedSchedule with 
  assetClass : StandardizedScheduleAssetClassEnum
  productClass : StandardizedScheduleProductClassEnum
  notional : Decimal
  notionalCurrency : Text
  durationInYears : Optional Decimal
    deriving (Eq, Ord, Show)

data StandardizedScheduleInitialMargin = StandardizedScheduleInitialMargin with 
  tradeInfo : [StandardizedScheduleTradeInfo]
  netInitialMargin : Money
    deriving (Eq, Ord, Show)

data StandardizedScheduleTradeInfo = StandardizedScheduleTradeInfo with 
  assetClass : Optional StandardizedScheduleAssetClassEnum
  productClass : Optional StandardizedScheduleProductClassEnum
  grossInitialMargin : Optional Quantity
  markToMarketValue : Optional Quantity
    deriving (Eq, Ord, Show)

-- | Defines the state of a trade at a point in the
--   Trade's life cycle. Trades have many state
--   dimensions, all of which are represented here. For
--   example, states useful for position keeping are
--   represented alongside those needed for regulatory
--   reporting.
data State = State with 
  closedState : Optional ClosedState
    -- ^ Represents the qualification of what led to the
    --   trade's closure alongside the dates on which this
    --   closure took effect.
  positionState : Optional PositionStatusEnum
    -- ^ Identifies the state of the position, to distinguish
    --   if just executed, formed, already settled, closed,
    --   etc.
    deriving (Eq, Ord, Show)

-- | Data required to perform a stock split business
--   event.
data StockSplitInstruction = StockSplitInstruction with 
  adjustmentRatio : Decimal
    -- ^ The number that denotes the cumulative quantity of
    --   post-split shares issued to shareholders versus the
    --   quantity of pre-split shares previously issued to
    --   shareholders.  This number will be multiplied by
    --   existing shares in an equity derivative contract or
    --   other positions to determine the post-split number of
    --   shares.  With regard to any reference to price, the
    --   pre-split reference price will be divided by this
    --   number to determine the post-split reference price.
  effectiveDate : Date
    -- ^ The effective date of the stock split, also known as
    --   the ex-date. This is the date on which the additional
    --   shares are paid to the shareholders, or in the case
    --   of a reverse stock split, the number shares held by
    --   each shareholder is proportionally reduced.  Equity
    --   derivative transactions can be amended in firms'
    --   internal systems on such date.   In most markets, the
    --   listed stock price is reduced (or increased for a
    --   reverse stock split) to account for the split on the
    --   same date, but in some markets the price adjustment
    --   occurs on a later date.  In either case, equity
    --   derivative transactions should be amended on the date
    --   that the stocks are paid to the shareholders (or
    --   consolidated).
    deriving (Eq, Ord, Show)

-- | A class for defining option strategy features.
data StrategyFeature = StrategyFeature with 
  strikeSpread : Optional StrikeSpread
    -- ^ Definition of the upper strike in a strike spread.
  calendarSpread : Optional CalendarSpread
    -- ^ Definition of the later expiration date in a calendar
    --   spread.
    deriving (Eq, Ord, Show)

-- | A class describing a single cap or floor rate.
data Strike = Strike with 
  strikeRate : Decimal
    -- ^ The rate for a cap or floor.
  buyer : Optional PayerReceiverEnum
    -- ^ The buyer of the option.
  seller : Optional PayerReceiverEnum
    -- ^ The party that has sold.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A class describing a schedule of cap or floor rates.
data StrikeSchedule = StrikeSchedule with 
  price : (ReferenceWithMeta PriceSchedule)
    -- ^ The initial rate. An initial rate of 5% would be
    --   represented as 0.05.
  buyer : Optional PayerReceiverEnum
    -- ^ The buyer of the option.
  seller : Optional PayerReceiverEnum
    -- ^ The party that has sold.
    deriving (Eq, Ord, Show)

-- | A class for defining a strike spread feature.
data StrikeSpread = StrikeSpread with 
  upperStrike : OptionStrike
    -- ^ Upper strike in a strike spread.
  upperStrikeNumberOfOptions : Decimal
    -- ^ Number of options at the upper strike price in a
    --   strike spread.
    deriving (Eq, Ord, Show)

-- | A data defining:  how the initial or final stub
--   calculation period amounts is calculated. For
--   example, the rate to be applied to the initial or
--   final stub calculation period may be the linear
--   interpolation of two different tenors for the
--   floating rate index specified in the calculation
--   period amount component, e.g. A two month stub period
--   may used the linear interpolation of a one month and
--   three month floating rate. The different rate tenors
--   would be specified in this component. Note that a
--   maximum of two rate tenors can be specified. If a
--   stub period uses a single index tenor and this is the
--   same as that specified in the calculation period
--   amount component then the initial stub or final stub
--   component, as the case may be, must not be included.
data StubCalculationPeriodAmount = StubCalculationPeriodAmount with 
  calculationPeriodDatesReference : (ReferenceWithMeta CalculationPeriodDates)
    -- ^ A pointer style reference to the associated
    --   calculation period dates component defined elsewhere
    --   in the document.
  initialStub : Optional StubValue
    -- ^ Specifies how the initial stub amount is calculated.
    --   A single floating rate tenor different to that used
    --   for the regular part of the calculation periods
    --   schedule may be specified, or two floating tenors may
    --   be specified. If two floating rate tenors are
    --   specified then Linear Interpolation (in accordance
    --   with the 2000 ISDA Definitions, Section 8.3.
    --   Interpolation) is assumed to apply. Alternatively, an
    --   actual known stub rate or stub amount may be
    --   specified.
  finalStub : Optional StubValue
    -- ^ Specifies how the final stub amount is calculated. A
    --   single floating rate tenor different to that used for
    --   the regular part of the calculation periods schedule
    --   may be specified, or two floating tenors may be
    --   specified. If two floating rate tenors are specified
    --   then Linear Interpolation (in accordance with the
    --   2000 ISDA Definitions, Section 8.3. Interpolation) is
    --   assumed to apply. Alternatively, an actual known stub
    --   rate or stub amount may be specified.
    deriving (Eq, Ord, Show)

-- | A class defining a floating rate.
data StubFloatingRate = StubFloatingRate with 
  floatingRateIndex : FloatingRateIndexEnum
    -- ^ The floating rate index.
  indexTenor : Optional Period
    -- ^ The ISDA Designated Maturity, i.e. the tenor of the
    --   floating rate.
  floatingRateMultiplierSchedule : Optional Schedule
    -- ^ A rate multiplier or multiplier schedule to apply to
    --   the floating rate. A multiplier schedule is expressed
    --   as explicit multipliers and dates. In the case of a
    --   schedule, the step dates may be subject to adjustment
    --   in accordance with any adjustments specified in the
    --   calculationPeriodDatesAdjustments. The multiplier can
    --   be a positive or negative decimal. This element
    --   should only be included if the multiplier is not
    --   equal to 1 (one) for the term of the stream.
  spreadSchedule : [SpreadSchedule]
    -- ^ The ISDA Spread or a Spread schedule expressed as
    --   explicit spreads and dates. In the case of a
    --   schedule, the step dates may be subject to adjustment
    --   in accordance with any adjustments specified in
    --   calculationPeriodDatesAdjustments. The spread is a
    --   per annum rate, expressed as a decimal. For purposes
    --   of determining a calculation period amount, if
    --   positive the spread will be added to the floating
    --   rate and if negative the spread will be subtracted
    --   from the floating rate. A positive 10 basis point
    --   (0.1%) spread would be represented as 0.001.
  rateTreatment : Optional RateTreatmentEnum
    -- ^ The specification of any rate conversion which needs
    --   to be applied to the observed rate before being used
    --   in any calculations. The two common conversions are
    --   for securities quoted on a bank discount basis which
    --   will need to be converted to either a Money Market
    --   Yield or Bond Equivalent Yield. See the Annex to the
    --   2000 ISDA Definitions, Section 7.3. Certain General
    --   Definitions Relating to Floating Rate Options,
    --   paragraphs (g) and (h) for definitions of these
    --   terms.
  capRateSchedule : [StrikeSchedule]
    -- ^ The cap rate or cap rate schedule, if any, which
    --   applies to the floating rate. The cap rate (strike)
    --   is only required where the floating rate on a swap
    --   stream is capped at a certain level. A cap rate
    --   schedule is expressed as explicit cap rates and dates
    --   and the step dates may be subject to adjustment in
    --   accordance with any adjustments specified in
    --   calculationPeriodDatesAdjustments. The cap rate is
    --   assumed to be exclusive of any spread and is a per
    --   annum rate, expressed as a decimal. A cap rate of 5%
    --   would be represented as 0.05.
  floorRateSchedule : [StrikeSchedule]
    -- ^ The floor rate or floor rate schedule, if any, which
    --   applies to the floating rate. The floor rate (strike)
    --   is only required where the floating rate on a swap
    --   stream is floored at a certain strike level. A floor
    --   rate schedule is expressed as explicit floor rates
    --   and dates and the step dates may be subject to
    --   adjustment in accordance with any adjustments
    --   specified in calculationPeriodDatesAdjustments. The
    --   floor rate is assumed to be exclusive of any spread
    --   and is a per annum rate, expressed as a decimal. A
    --   floor rate of 5% would be represented as 0.05.
    deriving (Eq, Ord, Show)

-- | A class defining how the initial or final stub
--   calculation period amounts is calculated. For
--   example, the rate to be applied to the initial or
--   final stub calculation period may be the linear
--   interpolation of two different tenors for the
--   floating rate index specified in the calculation
--   period amount component, e.g. A two month stub period
--   may used the linear interpolation of a one month and
--   three month floating rate. The different rate tenors
--   would be specified in this component. Note that a
--   maximum of two rate tenors can be specified. If a
--   stub period uses a single index tenor and this is the
--   same as that specified in the calculation period
--   amount component then the initial stub or final stub
--   component, as the case may be, must not be included.
data StubPeriod = StubPeriod with 
  calculationPeriodDatesReference : (ReferenceWithMeta CalculationPeriodDates)
    -- ^ A pointer style reference to the associated
    --   calculation period dates component defined elsewhere
    --   in the document.
  initialStub : Optional StubValue
    -- ^ Specifies how the initial stub amount is calculated.
    --   A single floating rate tenor different to that used
    --   for the regular part of the calculation periods
    --   schedule may be specified, or two floating tenors may
    --   be specified. If two floating rate tenors are
    --   specified then Linear Interpolation (in accordance
    --   with the 2000 ISDA Definitions, Section 8.3.
    --   Interpolation) is assumed to apply. Alternatively, an
    --   actual known stub rate or stub amount may be
    --   specified.
  finalStub : Optional StubValue
    -- ^ Specifies how the final stub amount is calculated. A
    --   single floating rate tenor different to that used for
    --   the regular part of the calculation periods schedule
    --   may be specified, or two floating tenors may be
    --   specified. If two floating rate tenors are specified
    --   then Linear Interpolation (in accordance with the
    --   2000 ISDA Definitions, Section 8.3. Interpolation) is
    --   assumed to apply. Alternatively, an actual known stub
    --   rate or stub amount may be specified.
    deriving (Eq, Ord, Show)

-- | A type defining how a stub calculation period amount
--   is calculated. A single floating rate tenor different
--   to that used for the regular part of the calculation
--   periods schedule may be specified, or two floating
--   rate tenors many be specified. If two floating rate
--   tenors are specified then Linear Interpolation (in
--   accordance with the 2000 ISDA Definitions, Section
--   8.3 Interpolation) is assumed to apply.
--   Alternatively, an actual known stub rate or stub
--   amount may be specified.
data StubValue = StubValue with 
  floatingRate : [StubFloatingRate]
    -- ^ The rates to be applied to the initial or final stub
    --   may be the linear interpolation of two different
    --   rates. While the majority of the time, the rate
    --   indices will be the same as that specified in the
    --   stream and only the tenor itself will be different,
    --   it is possible to specift two different rates. For
    --   example, a 2 month stub period may use the linear
    --   interpolation of a 1 month and 3 month rate. The
    --   different rates would be specified in this component.
    --   Note that a maximum of two rates can be specified. If
    --   a stub period uses the same floating rate index,
    --   including tenor, as the regular calculation periods
    --   then this should not be specified again within this
    --   component, i.e. the stub calculation period amount
    --   component may not need to be specified even if there
    --   is an initial or final stub period. If a stub period
    --   uses a different floating rate index compared to the
    --   regular calculation periods then this should be
    --   specified within this component. If specified here,
    --   they are likely to have id attributes, allowing them
    --   to be referenced from within the cashflows component.
  stubRate : Optional Decimal
    -- ^ An actual rate to apply for the initial or final stub
    --   period may have been agreed between the principal
    --   parties (in a similar way to how an initial rate may
    --   have been agreed for the first regular period). If an
    --   actual stub rate has been agreed then it would be
    --   included in this component. It will be a per annum
    --   rate, expressed as a decimal. A stub rate of 5% would
    --   be represented as 0.05.
  stubAmount : Optional Money
    -- ^ An actual amount to apply for the initial or final
    --   stub period may have been agreed between the two
    --   parties. If an actual stub amount has been agreed
    --   then it would be included in this component.
    deriving (Eq, Ord, Show)

-- | Defines collateral substitution provisions such as
--   how many and with how much notice are substitutions
--   allowed.
data SubstitutionProvisions = SubstitutionProvisions with 
  numberOfSubstitutionsAllowed : Optional Int
    -- ^ Specifies if 1 or more substitutions are allowed.
  noticeDeadlinePeriod : Optional Period
    -- ^ Defines the min period for notify of a substitution.
  noticeDeadlineDateTime : Optional ZonedDateTime
    -- ^ A specific date and time for the notice deadline
    deriving (Eq, Ord, Show)

-- | A class to specify a valuation swap curve, which is
--   used as part of the strike construct for the bond and
--   convertible bond options.
data SwapCurveValuation = SwapCurveValuation with 
  floatingRateIndex : FloatingRateIndexEnum
  indexTenor : Optional Period
    -- ^ The ISDA Designated Maturity, i.e. the tenor of the
    --   floating rate.
  spread : Decimal
    -- ^ Spread in basis points over the floating rate index.
  side : Optional QuotationSideEnum
    -- ^ The side (bid/mid/ask) of the measure.
    deriving (Eq, Ord, Show)

data Swp = Swp with 
  swpIn : SwpIn
  swpOut : SwpOut
    deriving (Eq, Ord, Show)

data SwpIn = SwpIn with 
  sngl : Sngl
    deriving (Eq, Ord, Show)

data SwpOut = SwpOut with 
  sngl : Sngl
    deriving (Eq, Ord, Show)

-- | Defines the taxonomy of an object by combining a
--   taxonomy source (i.e. the rules to classify the
--   object) and a value (i.e. the output of those rules
--   on the object).
data Taxonomy = Taxonomy with 
  source : Optional TaxonomySourceEnum
    -- ^ The source of the taxonomy that defines the rules for
    --   classifying the object. The taxonomy source is taken
    --   from a enumerated list of taxonomy names. Optional as
    --   the taxonomy source may not be provided.
  value : Optional TaxonomyValue
    -- ^ The value according to that taxonomy. Optional as it
    --   may not be possible to classify the object in that
    --   taxonomy.
    deriving (Eq, Ord, Show)

data TaxonomyClassification = TaxonomyClassification with 
  className : Optional Text
    -- ^ The name defined by the classification system for a
    --   specific attribute in the taxonomy
  value : Text
    -- ^ The value set by the taxonomy that is specific to the
    --   className attribute.
  description : Optional Text
    -- ^ A description of the class.
  ordinal : Optional Int
    -- ^ In the case of multi-layered hierarchical
    --   classification systems such as commodity
    --   classification, the layer the value and className
    --   occupy in the classification hierarchy, where 1
    --   represents the top-layer.
    deriving (Eq, Ord, Show)

-- | Defines a taxonomy value as either a simple string or
--   a more granular expression with class names and
--   values for each class.
data TaxonomyValue = TaxonomyValue with 
  name : Optional (FieldWithMeta Text)
    -- ^ Specifies the taxonomy value as a simple string,
    --   which may be associated to an external scheme.
  classification : [TaxonomyClassification]
    -- ^ Specifies the taxonomy value as a set of class names
    --   and values for each class.
    deriving (Eq, Ord, Show)

-- | A class to specify a telephone number as a type of
--   phone number (e.g. work, personal, ...) alongside
--   with the actual number.
data TelephoneNumber = TelephoneNumber with 
  telephoneNumberType : Optional TelephoneTypeEnum
    -- ^ The type of telephone number, e.g. work, mobile.
  number : Text
    -- ^ The actual telephone number.
    deriving (Eq, Ord, Show)

data Term = Term with 
  unit : Text
  val : Text
    deriving (Eq, Ord, Show)

-- | A class for defining option provisions.
data TerminationProvision = TerminationProvision with 
  cancelableProvision : Optional CancelableProvision
    -- ^ A provision that allows the specification of an
    --   embedded option within a swap giving the buyer of the
    --   option the right to terminate the swap, in whole or
    --   in part, on the early termination date.
  earlyTerminationProvision : Optional EarlyTerminationProvision
    -- ^ Parameters specifying provisions relating to the
    --   optional and mandatory early termination of a swap
    --   transaction.
  evergreenProvision : Optional EvergreenProvision
    -- ^ A data defining: the right of a party to exercise an
    --   Evergreen option
  extendibleProvision : Optional ExtendibleProvision
    -- ^ A provision that allows the specification of an
    --   embedded option with a swap giving the buyer of the
    --   option the right to extend the swap, in whole or in
    --   part, to the extended termination date.
    deriving (Eq, Ord, Show)

-- | Specifies instructions for terms change consisting of
--   the new transaction terms, and the renegotiation fee.
data TermsChangeInstruction = TermsChangeInstruction with 
  product : Optional NonTransferableProduct
    -- ^ product to be changed
  ancillaryParty : [AncillaryParty]
    -- ^ ancillary party to be changed
  adjustment : Optional NotionalAdjustmentEnum
    deriving (Eq, Ord, Show)

-- | The time alongside with the timezone location
--   information. This class makes use of the FpML
--   TimezoneLocation construct.
data TimeZone = TimeZone with 
  time : Text
    -- ^ The observation time.
  location : Optional (FieldWithMeta Text)
    -- ^ FpML specifies the timezoneLocationScheme by
    --   reference to the Time Zone Database (a.k.a. tz
    --   database) maintained by IANA, the Internet Assigned
    --   Numbers Authority.
    deriving (Eq, Ord, Show)

-- | Definition of a product as ready to be traded, i.e.
--   included in an execution or contract, by associating
--   a specific price and quantity to this product plus an
--   (optional) mechanism for any potential future
--   quantity adjustment.
data TradableProduct = TradableProduct with 
  product : NonTransferableProduct
    -- ^ The underlying product to be included in a contract
    --   or execution.
  tradeLot : [TradeLot]
    -- ^ Specifies the price, quantity and effective date of
    --   each trade lot, when the same product may be traded
    --   multiple times in different lots with the same
    --   counterparty. In a trade increase, a new trade lot is
    --   added to the list, with the corresponding effective
    --   date. In a trade decrease, the existing trade lot(s)
    --   are decreased of the corresponding quantity (and an
    --   unwind fee may have to be settled). The multiple
    --   cardinality and the ability to increase existing
    --   trades is used for Equity Swaps in particular.
  counterparty : [Counterparty]
    -- ^ Specifies the parties which are the two
    --   counterparties to the transaction.  The product is
    --   agnostic to the actual parties to the transaction,
    --   with the party references abstracted away from the
    --   product definition and replaced by the counterparty
    --   enum (e.g. CounterpartyEnum values Party1 or Party2).
    --   The counterparty enum can then be positioned in the
    --   product (e.g. to specify which counterparty is the
    --   payer, receiver etc) and this counterparties
    --   attribute, which is positioned outside of the product
    --   definition, allows the counterparty enum to be
    --   associated with an actual party reference.
  ancillaryParty : [AncillaryParty]
    -- ^ Specifies the parties with ancillary roles in the
    --   transaction. The product is agnostic to the actual
    --   parties involved in the transaction, with the party
    --   references abstracted away from the product
    --   definition and replaced by the AncillaryRoleEnum. The
    --   AncillaryRoleEnum can then be positioned in the
    --   product and this AncillaryParty type, which is
    --   positioned outside of the product definition, allows
    --   the AncillaryRoleEnum to be associated with an actual
    --   party reference.
  adjustment : Optional NotionalAdjustmentEnum
    -- ^ Specifies the conditions that govern the adjustment
    --   to the quantity of a product being traded: e.g.
    --   execution, portfolio rebalancing etc. It is typically
    --   used in the context of Equity Swaps.
    deriving (Eq, Ord, Show)

-- | Defines the output of a financial transaction between
--   parties - a Business Event. A Trade impacts the
--   financial position (i.e. the balance sheet) of
--   involved parties.
data Trade = Trade with 
  product : NonTransferableProduct
    -- ^ The underlying product to be included in a contract
    --   or execution.
  tradeLot : [TradeLot]
    -- ^ Specifies the price, quantity and effective date of
    --   each trade lot, when the same product may be traded
    --   multiple times in different lots with the same
    --   counterparty. In a trade increase, a new trade lot is
    --   added to the list, with the corresponding effective
    --   date. In a trade decrease, the existing trade lot(s)
    --   are decreased of the corresponding quantity (and an
    --   unwind fee may have to be settled). The multiple
    --   cardinality and the ability to increase existing
    --   trades is used for Equity Swaps in particular.
  counterparty : [Counterparty]
    -- ^ Specifies the parties which are the two
    --   counterparties to the transaction.  The product is
    --   agnostic to the actual parties to the transaction,
    --   with the party references abstracted away from the
    --   product definition and replaced by the counterparty
    --   enum (e.g. CounterpartyEnum values Party1 or Party2).
    --   The counterparty enum can then be positioned in the
    --   product (e.g. to specify which counterparty is the
    --   payer, receiver etc) and this counterparties
    --   attribute, which is positioned outside of the product
    --   definition, allows the counterparty enum to be
    --   associated with an actual party reference.
  ancillaryParty : [AncillaryParty]
    -- ^ Specifies the parties with ancillary roles in the
    --   transaction. The product is agnostic to the actual
    --   parties involved in the transaction, with the party
    --   references abstracted away from the product
    --   definition and replaced by the AncillaryRoleEnum. The
    --   AncillaryRoleEnum can then be positioned in the
    --   product and this AncillaryParty type, which is
    --   positioned outside of the product definition, allows
    --   the AncillaryRoleEnum to be associated with an actual
    --   party reference.
  adjustment : Optional NotionalAdjustmentEnum
    -- ^ Specifies the conditions that govern the adjustment
    --   to the quantity of a product being traded: e.g.
    --   execution, portfolio rebalancing etc. It is typically
    --   used in the context of Equity Swaps.
  tradeIdentifier : [TradeIdentifier]
    -- ^ Represents the identifier(s) that uniquely identify a
    --   trade for an identity issuer. A trade can include
    --   multiple identifiers, for example a trade that is
    --   reportable to both the CFTC and ESMA, and then has an
    --   associated USI (Unique Swap Identifier) UTI (Unique
    --   Trade Identifier).
  tradeDate : (FieldWithMeta Date)
    -- ^ Specifies the date which the trade was agreed.
  tradeTime : Optional (FieldWithMeta TimeZone)
    -- ^ Denotes the trade time and timezone as agreed by the
    --   parties to the trade.
  party : [Party]
    -- ^ Represents the parties to the trade. The cardinality
    --   is optional to address the case where the trade is
    --   defined within a BusinessEvent data type, in which
    --   case the party is specified in BusinessEvent.
  partyRole : [PartyRole]
    -- ^ Represents the role each specified party takes in the
    --   trade. further to the principal roles, payer and
    --   receiver.
  executionDetails : Optional ExecutionDetails
    -- ^ Represents information specific to trades that arose
    --   from executions.
  contractDetails : Optional ContractDetails
    -- ^ Represents information specific to trades involving
    --   contractual products.
  clearedDate : Optional Date
    -- ^ Specifies the date on which a trade is cleared
    --   (novated) through a central counterparty clearing
    --   service.
  collateral : Optional Collateral
    -- ^ Represents the collateral obligations of a party.
  account : [Account]
    -- ^ Represents a party's granular account
    --   information, which may be used in subsequent internal
    --   processing.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | Defines a trade identifier as a special case of the
--   generic identifier type, that also includes the trade
--   identifier class.
data TradeIdentifier = TradeIdentifier with 
  issuerReference : Optional (ReferenceWithMeta Party)
    -- ^ The identifier issuer, when specified by reference to
    --   a party specified as part of the transaction.
  issuer : Optional (FieldWithMeta Text)
    -- ^ The identifier issuer, when specified explicitly
    --   alongside the identifier value (instead of being
    --   specified by reference to a party).
  assignedIdentifier : [AssignedIdentifier]
    -- ^ The identifier value. This level of indirection
    --   between the issuer and the identifier and its version
    --   provides the ability to associate multiple
    --   identifiers to one issuer, consistently with the FpML
    --   PartyTradeIdentifier.
  meta : Optional MetaFields
  identifierType : Optional TradeIdentifierTypeEnum
    -- ^ The enumerated classification of the identifier.
    --   Optional as a trade identifier may be party-specific,
    --   in which case it may not correspond to any
    --   established classification.
    deriving (Eq, Ord, Show)

-- | Specifies the price and quantity of a trade lot,
--   where the same product could be traded multiple times
--   with the same counterparty but in different lots (at
--   a different date, in a different quantity and at a
--   different price). One trade lot combined with a
--   product definition specifies the entire economics of
--   a trade. The lifecycle mechanics of each such trade
--   lot (e.g. cashflow payments) is independent of the
--   other lots.
data TradeLot = TradeLot with 
  lotIdentifier : [Identifier]
    -- ^ Specifies one or more identifiers for the lot, if
    --   any.
  priceQuantity : [PriceQuantity]
    -- ^ Specifies the settlement characteristics of a trade
    --   lot: price, quantity, observable (optionally) and the
    --   settlement terms. This attribute has a multiple
    --   cardinality to allow to specify the price, quantity
    --   and observable of different legs in a single,
    --   composite product (e.g. a Swap).
    deriving (Eq, Ord, Show)

-- | The attributes that are specific for consensus based
--   pricing reporting.
data TradePricingReport = TradePricingReport with 
  trade : Trade
    -- ^ Represents the cosensus based pricing parameters on a
    --   trade basis.
  pricingTime : TimeZone
    -- ^ The regional exchange close time for the underlying
    --   contract,including time zone, at which the trades
    --   should be priced. This provides an indication for
    --   which regional snapshot should be used for pricing
    --   primarily for Global markets where there are multiple
    --   regional close times.
  discountingIndex : Optional FloatingRateIndexEnum
    -- ^ It specifies the interest payable on collateral
    --   delivered under a CSA covering the trade.
    deriving (Eq, Ord, Show)

-- | Defines the fundamental financial information that
--   can be changed by a Primitive Event and by extension
--   any business or life-cycle event. Each TradeState
--   specifies where a Trade is in its life-cycle.
--   TradeState is a root type and as such, can be created
--   independently to any other CDM data type, but can
--   also be used as part of the CDM Event Model.
data TradeState = TradeState with 
  trade : Trade
    -- ^ Represents the Trade that has been effected by a
    --   business or life-cycle event.
  state : Optional State
    -- ^ Represents the State of the Trade through its
    --   life-cycle.
  resetHistory : [Reset]
    -- ^ Represents the updated Trade attributes which can
    --   change as the result of a reset event. Only the
    --   changed values are captured, leaving the remaining
    --   data attributes empty. See Create_Reset function for
    --   further details on how TradeState is used in the
    --   Reset event. The TradeState data type is used to
    --   maintain backwards compatibility with the current
    --   Reset mechanism.
  transferHistory : [TransferState]
    -- ^ Represents the updated Trade attributes which can
    --   change as the result of a transfer event.
  observationHistory : [ObservationEvent]
    -- ^ Represents the observed events related to a
    --   particular product or process, such as credit events
    --   or corporate actions.
  valuationHistory : [Valuation]
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | The class to represent a CDS Tranche.
data Tranche = Tranche with 
  attachmentPoint : Decimal
    -- ^ Lower bound percentage of the loss that the Tranche
    --   can endure, expressed as a decimal. An attachment
    --   point of 5% would be represented as 0.05. The
    --   difference between Attachment and Exhaustion points
    --   is called the width of the Tranche.
  exhaustionPoint : Decimal
    -- ^ Upper bound percentage of the loss that the Tranche
    --   can endure, expressed as a decimal. An exhaustion
    --   point of 5% would be represented as 0.05. The
    --   difference between Attachment and Exhaustion points
    --   is call the width of the Tranche.
  incurredRecoveryApplicable : Optional Bool
    -- ^ Outstanding Swap Notional Amount is defined at any
    --   time on any day, as the greater of: (a) Zero; If
    --   Incurred Recovery Amount Applicable: (b) The Original
    --   Swap Notional Amount minus the sum of all Incurred
    --   Loss Amounts and all Incurred Recovery Amounts (if
    --   any) determined under this Confirmation at or prior
    --   to such time.Incurred Recovery Amount not populated:
    --   (b) The Original Swap Notional Amount minus the sum
    --   of all Incurred Loss Amounts determined under this
    --   Confirmation at or prior to such time.
    deriving (Eq, Ord, Show)

-- | A class to represent the transacted price attributes
--   that are positioned as part of the FpML FeeLeg.
data TransactedPrice = TransactedPrice with 
  marketFixedRate : Optional Decimal
    -- ^ An optional element that only has meaning in a credit
    --   index trade. This element contains the credit spread
    --   ('fair value') at which the trade was
    --   executed. Unlike the fixedRate of an index, the
    --   marketFixedRate varies over the life of the index
    --   depending on market conditions. The marketFixedRate
    --   is the price of the index as quoted by trading desks.
  initialPoints : Optional Decimal
    -- ^ An optional element that contains the up-front points
    --   expressed as a percentage of the notional. An
    --   initialPoints value of 5% would be represented as
    --   0.05. The initialPoints element is an alternative to
    --   marketFixedRate in quoting the traded level of a
    --   trade. When initialPoints is used, the traded level
    --   is the sum of fixedRate and initialPoints. The
    --   initialPoints is one of the items that are factored
    --   into the initialPayment calculation and is payable by
    --   the Buyer to the Seller. Note that initialPoints and
    --   marketFixedRate may both be present in the same
    --   document when both implied values are desired.
  marketPrice : Optional Decimal
    -- ^ An optional element that only has meaning in a credit
    --   index trade. This element contains the price at which
    --   the trade was executed and is used instead of
    --   marketFixedRate on credit trades on certain indicies
    --   which are quoted using a price rather than a spread.
  quotationStyle : Optional QuotationStyleEnum
    -- ^ An optional element that contains the up-front points
    --   expressed as a percentage of the notional. An
    --   initialPoints value of 5% would be represented as
    --   0.05. The initialPoints element is an alternative to
    --   marketFixedRate in quoting the traded level of a
    --   trade. When initialPoints is used, the traded level
    --   is the sum of fixedRate and initialPoints. The
    --   initialPoints is one of the items that are factored
    --   into the initialPayment calculation and is payable by
    --   the Buyer to the Seller. Note that initialPoints and
    --   marketFixedRate may both be present in the same
    --   document when both implied values are desired.
    deriving (Eq, Ord, Show)

-- | Additional specification for the extraordinary events
--   that may affect a trade and the related contractual
--   rights and obligation of the parties when this
--   happens. Such terms are typically required to extend
--   the economics terms, for the purpose of producing the
--   final legal contractual form of the Transaction.
data TransactionAdditionalTerms = TransactionAdditionalTerms with 
  equityAdditionalTerms : Optional EquityAdditionalTerms
  foreignExchangeAdditionalTerms : Optional FxAdditionalTerms
  commoditiesAdditionalTerms : Optional Text
  creditAdditionalTerms : Optional Text
  interestRateAdditionalTerms : Optional Text
  digitalAssetAdditionalTerms : Optional Text
    deriving (Eq, Ord, Show)

-- | Defines the movement of an Asset (eg cash, securities
--   or commodities) between two parties on a date.
data Transfer = Transfer with 
  identifier : [FieldWithMeta Identifier]
    -- ^ Represents a unique reference to the transfer.
  quantity : NonNegativeQuantity
    -- ^ Represents the amount of the asset to be transferred.
  asset : Asset
    -- ^ Represents the object that is subject to the
    --   transfer, it could be an asset or a reference.
  payerReceiver : PartyReferencePayerReceiver
    -- ^ Represents the parties to the transfer and their
    --   role.
  settlementDate : AdjustableOrAdjustedOrRelativeDate
    -- ^ Represents the date on which the transfer to due.
  settlementOrigin : Optional (ReferenceWithMeta Payout)
    -- ^ Represents the origin to the transfer as a reference
    --   for lineage purposes, whether it originated from
    --   trade level settlement terms or from payment terms on
    --   an economic payout.
  resetOrigin : Optional Reset
    -- ^ Represents the reset and observation values that were
    --   used to determine the transfer amount.
  transferExpression : TransferExpression
    -- ^ Specifies a transfer expression (cash price,
    --   performance amount, scheduled payment amount, etc.)
    --   to define the nature of the transfer amount and its
    --   source.
    deriving (Eq, Ord, Show)

data TransferBase = TransferBase with 
  identifier : [FieldWithMeta Identifier]
    -- ^ Represents a unique reference to the transfer.
  quantity : NonNegativeQuantity
    -- ^ Represents the amount of the asset to be transferred.
  asset : Asset
    -- ^ Represents the object that is subject to the
    --   transfer, it could be an asset or a reference.
  payerReceiver : PartyReferencePayerReceiver
    -- ^ Represents the parties to the transfer and their
    --   role.
  settlementDate : AdjustableOrAdjustedOrRelativeDate
    -- ^ Represents the date on which the transfer to due.
    deriving (Eq, Ord, Show)

-- | Specifies a transfer expression (cash price,
--   performance amount, scheduled payment amount, etc.)
--   to define the nature of the transfer amount and its
--   source.
data TransferExpression = TransferExpression with 
  priceTransfer : Optional FeeTypeEnum
    -- ^ Specifies a transfer amount exchanged as a price or
    --   fee for entering into a Business Event, e.g. Premium,
    --   Termination fee, Novation fee.
  scheduledTransfer : Optional ScheduledTransfer
    -- ^ Specifies a transfer created from a scheduled or
    --   contingent event on a contract, e.g. Exercise,
    --   Performance, Credit Event
    deriving (Eq, Ord, Show)

-- | Defines the payout on which to create a Transfer
--   along with all necessary resets.
data TransferInstruction = TransferInstruction with 
  transferState : [TransferState]
    -- ^ Specifies the terms and state of a transfers.
    deriving (Eq, Ord, Show)

-- | Defines the fundamental financial information
--   associated with a Transfer event. Each TransferState
--   specifies where a Transfer is in its life-cycle.
--   TransferState is a root type and as such, can be
--   created independently to any other CDM data type, but
--   can also be used as part of the CDM Event Model.
data TransferState = TransferState with 
  transfer : Transfer
    -- ^ Represents the Transfer that has been effected by a
    --   business or life-cycle event.
  transferStatus : Optional TransferStatusEnum
    -- ^ Represents the State of the Transfer through its
    --   life-cycle.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | A TransferableProduct is a type of financial product
--   which can be held or transferred, represented as an
--   Asset with the addition of specific EconomicTerms.
data TransferableProduct = TransferableProduct with 
  cash : Optional Cash
    -- ^ An Asset that consists solely of a monetary holding
    --   in a currency.
  commodity : Optional (FieldWithMeta Commodity)
    -- ^ An Asset comprised of raw or refined materials or
    --   agricultural products, eg gold, oil or wheat.
  digitalAsset : Optional DigitalAsset
    -- ^ An Asset that exists only in digital form, eg Bitcoin
    --   or Ethereum; excludes the digital representation of
    --   other Assets.
  instrument : Optional Instrument
    -- ^ An asset that is issued by one party to one or more
    --   others; Instrument is also a choice data type.
  economicTerms : EconomicTerms
    -- ^ The price forming features, including payouts and
    --   provisions.
    deriving (Eq, Ord, Show)

-- | Trigger point at which feature is effective.
data Trigger = Trigger with 
  level : [PriceSchedule]
    -- ^ The trigger level.
  creditEvents : Optional CreditEvents
  creditEventsReference : Optional (ReferenceWithMeta CreditEvents)
  triggerType : Optional TriggerTypeEnum
    -- ^ The Triggering condition.
  triggerTimeType : Optional TriggerTimeTypeEnum
    -- ^ The valuation time type of knock condition.
    deriving (Eq, Ord, Show)

-- | Observation point for trigger.
data TriggerEvent = TriggerEvent with 
  schedule : [AveragingSchedule]
    -- ^ A derivative schedule.
  triggerDates : Optional DateList
    -- ^ The trigger Dates.
  trigger : Trigger
    -- ^ The trigger level
  featurePayment : Optional FeaturePayment
    -- ^ The feature payment, i.e. the payment made following
    --   trigger occurrence.
    deriving (Eq, Ord, Show)

data Tx = Tx with 
  newTx : New
  tradDt : Text
  tradgCpcty : Text
  qty : Qty
  pric : Pric
  tradVn : Text
  ctryOfBrnch : Text
    deriving (Eq, Ord, Show)

-- | A class to specify a set of legal entities which are
--   part of a legal agreement beyond the two contracting
--   parties to that agreement. This data representation
--   reflects the ISDA Create representation.
data UmbrellaAgreement = UmbrellaAgreement with 
  isApplicable : Bool
    -- ^ The determination of whether Umbrella Agreement terms
    --   are Applicable (True), or Not Applicable (False)
  language : Optional Text
    -- ^ The language associated with the umbrella agreement,
    --   and which applies to all the parties to the umbrella
    --   agreement.
  parties : [UmbrellaAgreementEntity]
    -- ^ Underlying principals to the umbrella agreement.
    deriving (Eq, Ord, Show)

-- | A class to specify the legal entities that are part
--   of the umbrella agreement.
data UmbrellaAgreementEntity = UmbrellaAgreementEntity with 
  entityId : [FieldWithMeta Text]
    -- ^ A legal entity identifier (e.g. RED entity code).
  name : (FieldWithMeta Text)
    -- ^ The legal entity name.
  meta : Optional MetaFields
  terms : Optional Text
    -- ^ The terms that might be associated with each party to
    --   the umbrella agreement.
    deriving (Eq, Ord, Show)

-- | The underlying financial product that will be
--   physically or cash settled, which can be of any type,
--   eg an asset such as cash or a security, a product, or
--   the cash settlement of an index rate.  Conditions are
--   usually applied when used in a data type, such as a
--   payout, to ensure this aligns with the use case.
data Underlier = Underlier with 
  observable : Optional (ReferenceWithMeta Observable)
    -- ^ Specifies the object to be observed for a price, it
    --   could be an asset or a reference.
  product : Optional Product
    -- ^ Enables either a TransferableProduct or a
    --   NonTransferableProduct to be used in an underlier.
    deriving (Eq, Ord, Show)

-- | Where parties describe any substitution terms.
data UnderlierSubstitutionProvision = UnderlierSubstitutionProvision with 
  whoMaySubstitute : [CounterpartyRoleEnum]
    -- ^ Designates which Counterparty to the transaction who
    --   has the right to trigger a substitution or to provide
    --   related determination e.g. for instance to qualify
    --   the effectiveness of an Event which may be a trigger
    --   for substitution, determine the replacement Share to
    --   substitute, etc. ; cardinality of this object is 2,
    --   in case parties jointly have this role.
  substitutionBeSpokeTerms : [Clause]
    -- ^ Where parties describe any substitution terms e.g.
    --   for instance the election criteria for an Asset to be
    --   eligible as the Substitute Asset to the prior
    --   Affected Asset in terms of sector of activity,
    --   currency, market capitalisation, liquidity,
    --   volatility, or any additional features that parties
    --   would agree to take into considerations, etc.
  substitutionTriggerEvents : [ExtraordinaryEvents]
    -- ^ Where the parties may optionnally explictly specify
    --   the list of Events to be considered as a trigger for
    --   a Substitution.
  disputingParty : Optional CounterpartyRoleEnum
    -- ^ Where the party who is not granted with the
    --   substitution role at least has a right to dispute the
    --   determination given by the counterparty with such
    --   role. As an example, a given PartyA is the unique
    --   Counterparty with the Role of WhoMaySubstitute, yet
    --   PartyB could be Disputing Party in regard of such
    --   Role.
    deriving (Eq, Ord, Show)

data UndrlygInstrm = UndrlygInstrm with 
  swp : Swp
    deriving (Eq, Ord, Show)

-- | Defines the unit to be used for price, quantity, or
--   other purposes
data UnitType = UnitType with 
  capacityUnit : Optional CapacityUnitEnum
    -- ^ Provides an enumerated value for a capacity unit,
    --   generally used in the context of defining quantities
    --   for commodities.
  weatherUnit : Optional WeatherUnitEnum
    -- ^ Provides an enumerated values for a weather unit,
    --   generally used in the context of defining quantities
    --   for commodities.
  financialUnit : Optional FinancialUnitEnum
    -- ^ Provides an enumerated value for financial units,
    --   generally used in the context of defining quantities
    --   for securities.
  currency : Optional (FieldWithMeta Text)
    -- ^ Defines the currency to be used as a unit for a
    --   price, quantity, or other purpose.
    deriving (Eq, Ord, Show)

-- | Defines the value of an investment, asset, or
--   security
data Valuation = Valuation with 
  amount : Money
    -- ^ Current value of the outstanding contract
  timestamp : ZonedDateTime
    -- ^ Date and time of the last valuation marked to market,
    --   provided by the central counterparty (CCP) or
    --   calculated using the current or last available market
    --   price of the inputs.
  method : Optional ValuationTypeEnum
    -- ^ Method used for the valuation of the transaction by
    --   the valuation party.
  source : Optional ValuationSourceEnum
    -- ^ Source of the valuation of the transaction by the
    --   valuation party.
  delta : Optional Decimal
    -- ^ The ratio of the change in the price of a derivative
    --   transaction to the change in the price of the
    --   underlying. This field is applicable only to options
    --   and swaptions.
  valuationTiming : Optional PriceTimingEnum
    -- ^ Denotes when the valuation was sourced during a
    --   business day.
  priceComponent : Optional Price
    -- ^ Denotes the price used to compute the valuation.
    deriving (Eq, Ord, Show)

-- | A single object that represents the different methods
--   to specify a valuation date, as used for cash
--   settlement. The Single / Multiple ValuationDate is
--   used for the determination of recovery in a credit
--   event, the RelativeDateOffset is used for
--   cash-settled option, and FxFixingDate is used for
--   cross-currency settlement.
data ValuationDate = ValuationDate with 
  singleValuationDate : Optional SingleValuationDate
    -- ^ Where single valuation date is specified as being
    --   applicable for cash settlement, this element
    --   specifies the number of business days after
    --   satisfaction of all conditions to settlement when
    --   such valuation date occurs. ISDA 2003 Term: Single
    --   Valuation Date.
  multipleValuationDates : Optional MultipleValuationDates
    -- ^ Where multiple valuation dates are specified as being
    --   applicable for cash settlement, this element
    --   specifies (a) the number of applicable valuation
    --   dates, and (b) the number of business days after
    --   satisfaction of all conditions to settlement when the
    --   first such valuation date occurs, and (c) the number
    --   of business days thereafter of each successive
    --   valuation date. ISDA 2003 Term: Multiple Valuation
    --   Dates.
  valuationDate : Optional RelativeDateOffset
    -- ^ The date on which the cash settlement amount will be
    --   determined according to the cash settlement method if
    --   the parties have not otherwise been able to agree the
    --   cash settlement amount. This attribute was formerly
    --   part of 'OptionCashSettlement', which is now
    --   being harmonised into a common
    --   'CashSettlementTerms' that includes a
    --   'ValuationDate'.
  fxFixingDate : Optional FxFixingDate
    -- ^ The date on which the currency rate will be
    --   determined for the purpose of specifying the amount
    --   in deliverable currency. This attribute was formerly
    --   part of 'NonDeliverableSettlement', which is
    --   now being harmonised into a common
    --   'CashSettlementTerms' that includes a
    --   'ValuationDate'.
  fxFixingSchedule : Optional AdjustableDates
    -- ^ The date, when expressed as a schedule of date(s), on
    --   which the currency rate will be determined for the
    --   purpose of specifying the amount in deliverable
    --   currency. This attribute was formerly part of
    --   'NonDeliverableSettlement', which is now
    --   being harmonised into a common
    --   'CashSettlementTerms' that includes a
    --   'ValuationDate'.
    deriving (Eq, Ord, Show)

-- | Defines how and when a performance type option or
--   performance type swap is to be valued, including
--   initial, interim and final valuation dates.
data ValuationDates = ValuationDates with 
  initialValuationDate : Optional PerformanceValuationDates
    -- ^ Specifies the initial valuation dates of the
    --   underlyer.
  interimValuationDate : Optional PerformanceValuationDates
    -- ^ Specifies the interim valuation dates of the
    --   underlyer.
  finalValuationDate : PerformanceValuationDates
    -- ^ Specifies the final valuation dates of the underlyer.
    deriving (Eq, Ord, Show)

-- | Specifies inputs needed to process a valuation.
data ValuationInstruction = ValuationInstruction with 
  valuation : [Valuation]
    -- ^ Contains all information related to a valuation.
  replace : Bool
    -- ^ Specifies whether the previous valuation tracks in
    --   the valuation history are removed (True) or kept
    --   (False).
    deriving (Eq, Ord, Show)

-- | Specifies the parameters required to obtain a
--   valuation, including the source, quotation method
--   (bid, mid etc.) and any applicable quotation amount.
data ValuationMethod = ValuationMethod with 
  valuationSource : ValuationSource
    -- ^ The source for obtaining a valuation. This may come
    --   from some information source (e.g. Reuters), from a
    --   rate option fixing (e.g. FX fixing for cross-currency
    --   settlement), or from a set of reference banks. This
    --   is a mandatory attribute as the valuation method
    --   relies on one of those sources to be specified.
  quotationMethod : Optional QuotationRateTypeEnum
    -- ^ The type of price quotations to be requested from
    --   dealers when determining the market value of the
    --   reference obligation for purposes of cash settlement,
    --   or which rate quote is to be observed for a fixing.
    --   For example, Bid, Offer, Mid-market or Exercising
    --   Party Pays. ISDA 2003 Term: Quotation Method. The
    --   meaning of Exercising Party Pays is defined in the
    --   2000 ISDA Definitions, Section 17.2. Certain
    --   Definitions Relating to Cash Settlement, paragraph
    --   (j).
  valuationMethod : Optional ValuationMethodEnum
    -- ^ The ISDA defined methodology for determining the
    --   final price of the reference obligation for purposes
    --   of cash settlement. (ISDA 2003 Term: Valuation
    --   Method). For example, Market, Highest etc.
  quotationAmount : Optional Money
    -- ^ In the determination of a cash settlement amount, if
    --   weighted average quotations are to be obtained, the
    --   quotation amount specifies an upper limit to the
    --   outstanding principal balance of the reference
    --   obligation for which the quote should be obtained. If
    --   not specified, the ISDA definitions provide for a
    --   fallback amount equal to the floating rate payer
    --   calculation amount. ISDA 2003 Term: Quotation Amount.
  minimumQuotationAmount : Optional Money
    -- ^ In the determination of a cash settlement amount, if
    --   weighted average quotations are to be obtained, the
    --   minimum quotation amount specifies a minimum intended
    --   threshold amount of outstanding principal balance of
    --   the reference obligation for which the quote should
    --   be obtained. If not specified, the ISDA definitions
    --   provide for a fallback amount of the lower of either
    --   USD 1,000,000 (or its equivalent in the relevant
    --   obligation currency) or the quotation amount. ISDA
    --   2003 Term: Minimum Quotation Amount.
  cashCollateralValuationMethod : Optional CashCollateralValuationMethod
    -- ^ Specifies the parameters representing several
    --   mid-market valuation and replacement value methods.
    deriving (Eq, Ord, Show)

-- | Specifies how long to wait to get a quote from a
--   settlement rate option upon a price source
--   disruption.
data ValuationPostponement = ValuationPostponement with 
  maximumDaysOfPostponement : Int
    -- ^ The maximum number of days to wait for a quote from
    --   the disrupted settlement rate option before
    --   proceeding to the next method.
    deriving (Eq, Ord, Show)

-- | A class describing the method for obtaining a
--   settlement rate, specified through either an
--   information source (page), a settlement rate option
--   (fixing) or by using quotes from reference banks.
data ValuationSource = ValuationSource with 
  quotedCurrencyPair : Optional (ReferenceWithMeta QuotedCurrencyPair)
    -- ^ Defines the two currencies for an FX trade and the
    --   quotation relationship between the two currencies. 
    --   This attribute was formerly part of
    --   'fxSettlementTerms', which is now being
    --   harmonised into a common
    --   'CashSettlementTerms' that includes a
    --   'ValuationDate'.
  informationSource : Optional FxSpotRateSource
    -- ^ The information source where a published or displayed
    --   market rate will be obtained, e.g. Telerate Page
    --   3750.
  settlementRateOption : Optional SettlementRateOption
    -- ^ The rate option to use for the fixing. Currently only
    --   applicable to foreign exchange fixing in case of
    --   cross-currency settlement.
  referenceBanks : Optional ReferenceBanks
    -- ^ A container for a set of reference institutions that
    --   may be called upon to provide rate quotations as part
    --   of the method to determine the applicable cash
    --   settlement amount. If institutions are not specified,
    --   it is assumed that reference institutions will be
    --   agreed between the parties on the exercise date, or
    --   in the case of swap transaction to which mandatory
    --   early termination is applicable, the cash settlement
    --   valuation date.
  dealerOrCCP : Optional AncillaryEntity
    -- ^ Holds an identifier for the reference entity that is
    --   agreed by both parties as a basis for cash settlement
    --   calculations. This could be a dealer from whom
    --   quotations are obtained by the calculation agent on
    --   the reference obligation for purposes of cash
    --   settlement in a credit event. ISDA 2003 Term: Dealer.
    --   This could be the clearing organization (CCP, DCO) to
    --   which the trade should be cleared, as applicable for
    --   cash-settled swaptions.
    deriving (Eq, Ord, Show)

data ValuationTerms = ValuationTerms with 
  futuresPriceValuation : Optional Bool
    -- ^ The official settlement price as announced by the
    --   related exchange is applicable, in accordance with
    --   the ISDA 2002 definitions.
  optionsPriceValuation : Optional Bool
    -- ^ The official settlement price as announced by the
    --   related exchange is applicable, in accordance with
    --   the ISDA 2002 definitions
  numberOfValuationDates : Optional Int
    -- ^ The number of valuation dates between valuation start
    --   date and valuation end date.
  dividendValuationDates : Optional AdjustableRelativeOrPeriodicDates
    -- ^ Specifies the dividend valuation dates of the swap.
  fPVFinalPriceElectionFallback : Optional FPVFinalPriceElectionFallbackEnum
    -- ^ Specifies the fallback provisions for Hedging Party
    --   in the determination of the Final Price.
  multipleExchangeIndexAnnexFallback : Optional Bool
    -- ^ For an index option transaction, a flag to indicate
    --   whether a relevant Multiple Exchange Index Annex is
    --   applicable to the transaction. This annex defines
    --   additional provisions which are applicable where an
    --   index is comprised of component securities that are
    --   traded on multiple exchanges.
  componentSecurityIndexAnnexFallback : Optional Bool
    -- ^ For an index option transaction, a flag to indicate
    --   whether a relevant Component Security Index Annex is
    --   applicable to the transaction.
    deriving (Eq, Ord, Show)

data VarianceCapFloor = VarianceCapFloor with 
  varianceCap : Bool
    -- ^ If present and true, then variance cap is applicable.
  unadjustedVarianceCap : Optional Decimal
    -- ^ For use when varianceCap is applicable. Contains the
    --   scaling factor of the Variance Cap that can differ on
    --   a trade-by-trade basis in the European market. For
    --   example, a Variance Cap of 2.5^2 x Variance Strike
    --   Price has an unadjustedVarianceCap of 2.5.
  boundedVariance : Optional BoundedVariance
    -- ^ Conditions which bound variance. The contract
    --   specifies one or more boundary levels. These levels
    --   are expressed as prices for confirmation purposes
    --   Underlyer price must be equal to or higher than Lower
    --   Barrier is known as Up Conditional Swap Underlyer
    --   price must be equal to or lower than Upper Barrier is
    --   known as Down Conditional Swap Underlyer price must
    --   be equal to or higher than Lower Barrier and must be
    --   equal to or lower than Upper Barrier is known as
    --   Barrier Conditional Swap.
    deriving (Eq, Ord, Show)

data VarianceReturnTerms = VarianceReturnTerms with 
  valuationTerms : ValuationTerms
    -- ^ Contains all non-date valuation information.
  annualizationFactor : Optional Int
    -- ^ This specifies the numerator of an annualization
    --   factor. Frequently this number is equal to the number
    --   of observations of prices in a year e.g. 252.
  dividendApplicability : Optional DividendApplicability
    -- ^ The parameters which define whether dividends are
    --   applicable
  equityUnderlierProvisions : Optional EquityUnderlierProvisions
    -- ^ Contains Equity Underlyer provisions regarding
    --   jurisdiction and fallbacks.
  sharePriceDividendAdjustment : Optional Bool
    -- ^ Indicates whether the price of shares is adjusted for
    --   dividends or not.
  expectedN : Int
    -- ^ Expected number of trading days.
  initialLevel : Optional Decimal
    -- ^ Contract will strike off this initial level.
    --   Providing just the initialLevel without
    --   initialLevelSource, infers that this is
    --   AgreedInitialPrice - a specified Initial Index Level.
  initialLevelSource : Optional DeterminationMethodEnum
    -- ^ In this context, this is AgreedInitialPrice - a
    --   specified Initial Index Level.
  meanAdjustment : Optional Bool
    -- ^ Specifies whether Mean Adjustment is applicable or
    --   not in the calculation of the Realized Volatility,
    --   Variance or Correlation
  performance : Optional Text
    -- ^ Performance calculation, in accordance with Part 1
    --   Section 12 of the 2018 ISDA CDM Equity Confirmation
    --   for Security Equity Swap, Para 75. 'Equity
    --   Performance'. Cumulative performance is used as a
    --   notional multiplier factor on both legs of an Equity
    --   Swap.
  varianceStrikePrice : Optional Price
    -- ^ Variance Strike Price in accordance with the ISDA
    --   2011 Equity Derivatives Definitions.
  volatilityStrikePrice : Optional Price
    -- ^ Volatility Strike Price in accordance with the ISDA
    --   2011 Equity Derivatives Definitions.
  varianceCapFloor : Optional VarianceCapFloor
    -- ^ Contains possible barriers for variance products,
    --   both variance-based and underlier price based
  volatilityCapFloor : Optional VolatilityCapFloor
    -- ^ Contains containing volatility-based barriers
  vegaNotionalAmount : Optional NonNegativeQuantitySchedule
    -- ^ Vega Notional represents the approximate gain/loss at
    --   maturity for a 1% difference between RVol (realised
    --   vol) and KVol (strike vol). It does not necessarily
    --   represent the Vega Risk of the trade.
  exchangeTradedContractNearest : Optional (ReferenceWithMeta Observable)
    -- ^ Specification of the exchange traded contract
    --   nearest.
    deriving (Eq, Ord, Show)

data Velocity = Velocity with 
  periodMultiplier : Optional Int
  period : Optional PeriodTimeEnum
    deriving (Eq, Ord, Show)

-- | Contains volatility-based barriers. Volatility Cap
--   needs to be specified in accordance with the ISDA
--   2011 Equity Derivatives Definitions.
data VolatilityCapFloor = VolatilityCapFloor with 
  applicable : Bool
    -- ^ Indicates whether the volatility cap is applicable in
    --   accordance with the ISDA 2011 Equity Derivatives
    --   Definitions. Setting the element 'applicable'
    --   to 'False' - means No Volatility Cap and no
    --   'totalVolatilityCap' or
    --   'volatilityCapFactor' should be provided.
    --   Setting the element 'applicable' to
    --   'True' - means Volatility Cap election, then
    --   'totalVolatilityCap' or
    --   'volatilityCapFactor' should be provided,
    --   otherwise it defaults to volatilityCapFactor=2.5.
  totalVolatilityCap : Optional Decimal
    -- ^ Volatility Cap Amount in accordance with the ISDA
    --   2011 Equity Derivatives Definitions. This means the
    --   Volatility Cap Amount election is a number.
  volatilityCapFactor : Optional Decimal
    -- ^ Volatility Cap Amount in accordance with the ISDA
    --   2011 Equity Derivatives Definitions. The Calculated
    --   VolCapAmt can be optionally provided.
    deriving (Eq, Ord, Show)

data VolatilityReturnTerms = VolatilityReturnTerms with 
  valuationTerms : ValuationTerms
    -- ^ Contains all non-date valuation information.
  annualizationFactor : Optional Int
    -- ^ This specifies the numerator of an annualization
    --   factor. Frequently this number is equal to the number
    --   of observations of prices in a year e.g. 252.
  dividendApplicability : Optional DividendApplicability
    -- ^ The parameters which define whether dividends are
    --   applicable
  equityUnderlierProvisions : Optional EquityUnderlierProvisions
    -- ^ Contains Equity Underlyer provisions regarding
    --   jurisdiction and fallbacks.
  sharePriceDividendAdjustment : Optional Bool
    -- ^ Indicates whether the price of shares is adjusted for
    --   dividends or not.
  expectedN : Int
    -- ^ Expected number of trading days.
  initialLevel : Optional Decimal
    -- ^ Contract will strike off this initial level.
    --   Providing just the initialLevel without
    --   initialLevelSource, infers that this is
    --   AgreedInitialPrice - a specified Initial Index Level.
  initialLevelSource : Optional DeterminationMethodEnum
    -- ^ In this context, this is AgreedInitialPrice - a
    --   specified Initial Index Level.
  meanAdjustment : Optional Bool
    -- ^ Specifies whether Mean Adjustment is applicable or
    --   not in the calculation of the Realized Volatility,
    --   Variance or Correlation
  performance : Optional Text
    -- ^ Performance calculation, in accordance with Part 1
    --   Section 12 of the 2018 ISDA CDM Equity Confirmation
    --   for Security Equity Swap, Para 75. 'Equity
    --   Performance'. Cumulative performance is used as a
    --   notional multiplier factor on both legs of an Equity
    --   Swap.
  volatilityStrikePrice : Price
    -- ^ Volatility Strike Price in accordance with the ISDA
    --   2011 Equity Derivatives Definitions.
  volatilityCapFloor : Optional VolatilityCapFloor
    -- ^ Contains volatility-based barriers
  exchangeTradedContractNearest : Optional ListedDerivative
    -- ^ Specification of the exchange traded contract
    --   nearest.
    deriving (Eq, Ord, Show)

-- | A single weighted averaging observation.
data WeightedAveragingObservation = WeightedAveragingObservation with 
  dateTime : Optional ZonedDateTime
    -- ^ Observation date time, which should be used when
    --   literal observation dates are required. The CDM
    --   specifies that the zoned date time is to be expressed
    --   in accordance with ISO 8601, either as UTC as an
    --   offset to UTC.
  observationNumber : Optional Int
    -- ^ Observation number, which should be unique, within a
    --   series generated by a date schedule.
  weight : Decimal
    -- ^ Observation weight, which is used as a multiplier for
    --   the observation value.
    deriving (Eq, Ord, Show)

-- | A collection of workflow steps which together makeup
--   an entire workflow sequence.
data Workflow = Workflow with 
  steps : [WorkflowStep]
    deriving (Eq, Ord, Show)

-- | A class to specify workflow information, which is
--   conceptually applicable to all lifecycle events.
data WorkflowState = WorkflowState with 
  workflowStatus : WorkflowStatusEnum
    -- ^ The workflow status indicator, e.g. Accepted,
    --   Rejected, ...
  comment : Optional Text
    -- ^ A comment field to be associated with the workflow,
    --   e.g. to specify why a transaction event was rejected
    --   by a party.
  partyCustomisedWorkflow : [PartyCustomisedWorkflow]
    -- ^ Workflow data that is specific to certain market
    --   participants and is expressed as part of the CDM in a
    --   very generic manner, which can be party-specific. The
    --   initial use cases have been derived from the CME
    --   clearing and the DTCC TIW submissions.
  warehouseIdentity : Optional WarehouseIdentityEnum
    -- ^ The identity of the warehouse, if any, that is
    --   executing that workflow step.
    deriving (Eq, Ord, Show)

-- | A workflow step represents the state of a business
--   event. The workflow step contains a reference to a
--   previous WorkflowStep in order to preserve lineage. A
--   workflow step is accepted if it contains a business
--   event, proposed if proposedEvent is present and is
--   rejected if the rejected flag is set.
data WorkflowStep = WorkflowStep with 
  businessEvent : Optional BusinessEvent
    -- ^ Life cycle event for the step. The businessEvent is
    --   optional when a proposedEvent or rejection are
    --   present.
  counterpartyPositionBusinessEvent : Optional CounterpartyPositionBusinessEvent
    -- ^ Documents the life cycle event for a position.
  proposedEvent : Optional EventInstruction
    -- ^ The proposed event for a workflow step. The
    --   proposedEvent is optional when the businessEvent or
    --   rejection are present
  rejected : Optional Bool
    -- ^ Flags this step as rejected.
  approval : [WorkflowStepApproval]
    -- ^ Optional party approvals for the current workflow
    --   step. A workflow step can have any number of parties
    --   associated to it, thus this object is represented as
    --   a list. All parties that are expected to provide
    --   approval should have an item in this list that
    --   references them.
  previousWorkflowStep : Optional (ReferenceWithMeta WorkflowStep)
    -- ^ Optional previous workflow step that provides lineage
    --   to workflow steps that precedes it.
  nextEvent : Optional EventInstruction
    -- ^ The intended next event can be specified, even if the
    --   instructions are not known yet.
  messageInformation : Optional MessageInformation
    -- ^ Contains all information pertaining the FpML
    --   messaging header 
  timestamp : [EventTimestamp]
    -- ^ The set of timestamp(s) associated with the event as
    --   a collection of [dateTime, qualifier].
  eventIdentifier : [Identifier]
    -- ^ The identifier(s) that uniquely identify a lifecycle
    --   event. The unbounded cardinality is meant to provide
    --   the ability to associate identifiers that are issued
    --   by distinct parties. As an example, each of the
    --   parties to the event may choose to associate their
    --   own identifiers to the event.
  action : Optional ActionEnum
    -- ^ Specifies whether the event is a new, a correction or
    --   a cancellation.
  party : [Party]
    -- ^ The specification of the event parties. This
    --   attribute is optional, as not applicable to certain
    --   events (e.g. most of the observations).
  account : [Account]
    -- ^ Optional account information that could be associated
    --   to the event.
  lineage : Optional Lineage
    -- ^ The lineage attribute provides a linkage among
    --   lifecycle events through the globalKey hash value.
    --   One example is when a given lifecycle event is being
    --   corrected or cancelled. In such case, each subsequent
    --   event will have lineage into the prior version of
    --   that event. The second broad use case is when an
    --   event has a dependency upon either another event
    --   (e.g. the regular payment associated with a fix/float
    --   swap will have a lineage into the reset event, which
    --   will in turn have a lineage into the observation
    --   event for the floating rate and the contract) or a
    --   contract (e.g. the exercise of an option has a
    --   lineage into that option).
  creditLimitInformation : Optional CreditLimitInformation
  workflowState : Optional WorkflowState
    -- ^ The event workflow information, i.e. the workflow
    --   status, the associated comment and the
    --   partyCustomisedWorkflow which purpose is to provide
    --   the ability to associate custom workflow information
    --   to the CDM.
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)

-- | Party approvals associated to the current
--   WorkflowStep. 
data WorkflowStepApproval = WorkflowStepApproval with 
  approved : Bool
    -- ^ Flag denoting whether the workflow step is approved
    --   or not
  party : (ReferenceWithMeta Party)
    -- ^ Reference to the Party who is approving/rejecting
    --   this workflow step
  rejectedReason : Optional Text
    -- ^ Optional reason for rejecting the workflow step
  timestamp : EventTimestamp
    -- ^ Timestamp of the approval
  meta : Optional MetaFields
    deriving (Eq, Ord, Show)





© 2015 - 2025 Weber Informatics LLC | Privacy Policy