import type { BinaryWriteOptions } from '@protobuf-ts/runtime';
import type { IBinaryWriter } from '@protobuf-ts/runtime';
import type { BinaryReadOptions } from '@protobuf-ts/runtime';
import type { IBinaryReader } from '@protobuf-ts/runtime';
import type { PartialMessage } from '@protobuf-ts/runtime';
import { MessageType } from '@protobuf-ts/runtime';
import { Status } from '../../../../../google/rpc/status.js';
import { Timestamp } from '../../../../../google/protobuf/timestamp.js';
import { Record } from './value.js';
import { Value } from './value.js';
import { Identifier } from './value.js';
/**
 * Events in transactions can have two primary shapes:
 *
 * - ACS delta: events can be CreatedEvent or ArchivedEvent
 * - ledger effects: events can be CreatedEvent or ExercisedEvent
 *
 * In the update service the events are restricted to the events
 * visible for the parties specified in the transaction filter. Each
 * event message type below contains a ``witness_parties`` field which
 * indicates the subset of the requested parties that can see the event
 * in question.
 *
 * @generated from protobuf message com.daml.ledger.api.v2.Event
 */
export interface Event {
    /**
     * @generated from protobuf oneof: event
     */
    event: {
        oneofKind: 'created';
        /**
         * The event as it appeared in the context of its original daml transaction on this participant node.
         * In particular, the offset, node_id pair of the daml transaction are preserved.
         *
         * @generated from protobuf field: com.daml.ledger.api.v2.CreatedEvent created = 1
         */
        created: CreatedEvent;
    } | {
        oneofKind: 'archived';
        /**
         * @generated from protobuf field: com.daml.ledger.api.v2.ArchivedEvent archived = 2
         */
        archived: ArchivedEvent;
    } | {
        oneofKind: 'exercised';
        /**
         * @generated from protobuf field: com.daml.ledger.api.v2.ExercisedEvent exercised = 3
         */
        exercised: ExercisedEvent;
    } | {
        oneofKind: undefined;
    };
}
/**
 * Records that a contract has been created, and choices may now be exercised on it.
 *
 * @generated from protobuf message com.daml.ledger.api.v2.CreatedEvent
 */
export interface CreatedEvent {
    /**
     * The offset of origin, which has contextual meaning, please see description at messages that include a CreatedEvent.
     * Offsets are managed by the participant nodes.
     * Transactions can thus NOT be assumed to have the same offsets on different participant nodes.
     * Required, it is a valid absolute offset (positive integer)
     *
     * @generated from protobuf field: int64 offset = 1
     */
    offset: bigint;
    /**
     * The position of this event in the originating transaction or reassignment.
     * The origin has contextual meaning, please see description at messages that include a CreatedEvent.
     * Node IDs are not necessarily equal across participants,
     * as these may see different projections/parts of transactions.
     * Required, must be valid node ID (non-negative integer)
     *
     * @generated from protobuf field: int32 node_id = 2
     */
    nodeId: number;
    /**
     * The ID of the created contract.
     * Must be a valid LedgerString (as described in ``value.proto``).
     * Required
     *
     * @generated from protobuf field: string contract_id = 3
     */
    contractId: string;
    /**
     * The template of the created contract.
     * The identifier uses the package-id reference format.
     *
     * Required
     *
     * @generated from protobuf field: com.daml.ledger.api.v2.Identifier template_id = 4
     */
    templateId?: Identifier;
    /**
     * The key of the created contract.
     * This will be set if and only if ``create_arguments`` is set and ``template_id`` defines a contract key.
     * Optional
     *
     * @generated from protobuf field: com.daml.ledger.api.v2.Value contract_key = 5
     */
    contractKey?: Value;
    /**
     * The arguments that have been used to create the contract.
     * Set either:
     *
     * - if there was a party, which is in the ``witness_parties`` of this event,
     *   and for which a ``CumulativeFilter`` exists with the ``template_id`` of this event
     *   among the ``template_filters``,
     * - or if there was a party, which is in the ``witness_parties`` of this event,
     *   and for which a wildcard filter exists (``Filters`` with a ``CumulativeFilter`` of ``WildcardFilter``).
     *
     * Optional
     *
     * @generated from protobuf field: com.daml.ledger.api.v2.Record create_arguments = 6
     */
    createArguments?: Record;
    /**
     * Opaque representation of contract create event payload intended for forwarding
     * to an API server as a contract disclosed as part of a command
     * submission.
     * Optional
     *
     * @generated from protobuf field: bytes created_event_blob = 7
     */
    createdEventBlob: Uint8Array;
    /**
     * Interface views specified in the transaction filter.
     * Includes an ``InterfaceView`` for each interface for which there is a ``InterfaceFilter`` with
     *
     * - its party in the ``witness_parties`` of this event,
     * - and which is implemented by the template of this event,
     * - and which has ``include_interface_view`` set.
     *
     * Optional
     *
     * @generated from protobuf field: repeated com.daml.ledger.api.v2.InterfaceView interface_views = 8
     */
    interfaceViews: InterfaceView[];
    /**
     * The parties that are notified of this event. When a ``CreatedEvent``
     * is returned as part of a transaction tree or ledger-effects transaction, this will include all
     * the parties specified in the ``TransactionFilter`` that are informees
     * of the event. If served as part of a ACS delta transaction those will
     * be limited to all parties specified in the ``TransactionFilter`` that
     * are stakeholders of the contract (i.e. either signatories or observers).
     * If the ``CreatedEvent`` is returned as part of an AssignedEvent,
     * ActiveContract or IncompleteUnassigned (so the event is related to
     * an assignment or unassignment): this will include all parties of the
     * ``TransactionFilter`` that are stakeholders of the contract.
     *
     * The behavior of reading create events visible to parties not hosted
     * on the participant node serving the Ledger API is undefined. Concretely,
     * there is neither a guarantee that the participant node will serve all their
     * create events on the ACS stream, nor is there a guarantee that matching archive
     * events are delivered for such create events.
     *
     * For most clients this is not a problem, as they only read events for parties
     * that are hosted on the participant node. If you need to read events
     * for parties that may not be hosted at all times on the participant node,
     * subscribe to the ``TopologyEvent``s for that party by setting a corresponding
     * ``UpdateFormat``.  Using these events, query the ACS as-of an offset where the
     * party is hosted on the participant node, and ignore create events at offsets
     * where the party is not hosted on the participant node.
     * Required
     *
     * @generated from protobuf field: repeated string witness_parties = 9
     */
    witnessParties: string[];
    /**
     * The signatories for this contract as specified by the template.
     * Required
     *
     * @generated from protobuf field: repeated string signatories = 10
     */
    signatories: string[];
    /**
     * The observers for this contract as specified explicitly by the template or implicitly as choice controllers.
     * This field never contains parties that are signatories.
     * Required
     *
     * @generated from protobuf field: repeated string observers = 11
     */
    observers: string[];
    /**
     * Ledger effective time of the transaction that created the contract.
     * Required
     *
     * @generated from protobuf field: google.protobuf.Timestamp created_at = 12
     */
    createdAt?: Timestamp;
    /**
     * The package name of the created contract.
     * Required
     *
     * @generated from protobuf field: string package_name = 13
     */
    packageName: string;
}
/**
 * View of a create event matched by an interface filter.
 *
 * @generated from protobuf message com.daml.ledger.api.v2.InterfaceView
 */
export interface InterfaceView {
    /**
     * The interface implemented by the matched event.
     * The identifier uses the package-id reference format.
     *
     * Required
     *
     * @generated from protobuf field: com.daml.ledger.api.v2.Identifier interface_id = 1
     */
    interfaceId?: Identifier;
    /**
     * Whether the view was successfully computed, and if not,
     * the reason for the error. The error is reported using the same rules
     * for error codes and messages as the errors returned for API requests.
     * Required
     *
     * @generated from protobuf field: google.rpc.Status view_status = 2
     */
    viewStatus?: Status;
    /**
     * The value of the interface's view method on this event.
     * Set if it was requested in the ``InterfaceFilter`` and it could be
     * sucessfully computed.
     * Optional
     *
     * @generated from protobuf field: com.daml.ledger.api.v2.Record view_value = 3
     */
    viewValue?: Record;
}
/**
 * Records that a contract has been archived, and choices may no longer be exercised on it.
 *
 * @generated from protobuf message com.daml.ledger.api.v2.ArchivedEvent
 */
export interface ArchivedEvent {
    /**
     * The offset of origin.
     * Offsets are managed by the participant nodes.
     * Transactions can thus NOT be assumed to have the same offsets on different participant nodes.
     * Required, it is a valid absolute offset (positive integer)
     *
     * @generated from protobuf field: int64 offset = 1
     */
    offset: bigint;
    /**
     * The position of this event in the originating transaction or reassignment.
     * Node IDs are not necessarily equal across participants,
     * as these may see different projections/parts of transactions.
     * Required, must be valid node ID (non-negative integer)
     *
     * @generated from protobuf field: int32 node_id = 2
     */
    nodeId: number;
    /**
     * The ID of the archived contract.
     * Must be a valid LedgerString (as described in ``value.proto``).
     * Required
     *
     * @generated from protobuf field: string contract_id = 3
     */
    contractId: string;
    /**
     * The template of the archived contract.
     * The identifier uses the package-id reference format.
     *
     * Required
     *
     * @generated from protobuf field: com.daml.ledger.api.v2.Identifier template_id = 4
     */
    templateId?: Identifier;
    /**
     * The parties that are notified of this event. For an ``ArchivedEvent``,
     * these are the intersection of the stakeholders of the contract in
     * question and the parties specified in the ``TransactionFilter``. The
     * stakeholders are the union of the signatories and the observers of
     * the contract.
     * Each one of its elements must be a valid PartyIdString (as described
     * in ``value.proto``).
     * Required
     *
     * @generated from protobuf field: repeated string witness_parties = 5
     */
    witnessParties: string[];
    /**
     * The package name of the contract.
     * Required
     *
     * @generated from protobuf field: string package_name = 6
     */
    packageName: string;
    /**
     * The interfaces implemented by the target template that have been
     * matched from the interface filter query.
     * Populated only in case interface filters with include_interface_view set.
     *
     * If defined, the identifier uses the package-id reference format.
     *
     * Optional
     *
     * @generated from protobuf field: repeated com.daml.ledger.api.v2.Identifier implemented_interfaces = 7
     */
    implementedInterfaces: Identifier[];
}
/**
 * Records that a choice has been exercised on a target contract.
 *
 * @generated from protobuf message com.daml.ledger.api.v2.ExercisedEvent
 */
export interface ExercisedEvent {
    /**
     * The offset of origin.
     * Offsets are managed by the participant nodes.
     * Transactions can thus NOT be assumed to have the same offsets on different participant nodes.
     * Required, it is a valid absolute offset (positive integer)
     *
     * @generated from protobuf field: int64 offset = 1
     */
    offset: bigint;
    /**
     * The position of this event in the originating transaction or reassignment.
     * Node IDs are not necessarily equal across participants,
     * as these may see different projections/parts of transactions.
     * Required, must be valid node ID (non-negative integer)
     *
     * @generated from protobuf field: int32 node_id = 2
     */
    nodeId: number;
    /**
     * The ID of the target contract.
     * Must be a valid LedgerString (as described in ``value.proto``).
     * Required
     *
     * @generated from protobuf field: string contract_id = 3
     */
    contractId: string;
    /**
     * The template of the target contract.
     * The identifier uses the package-id reference format.
     *
     * Required
     *
     * @generated from protobuf field: com.daml.ledger.api.v2.Identifier template_id = 4
     */
    templateId?: Identifier;
    /**
     * The interface where the choice is defined, if inherited.
     * If defined, the identifier uses the package-id reference format.
     *
     * Optional
     *
     * @generated from protobuf field: com.daml.ledger.api.v2.Identifier interface_id = 5
     */
    interfaceId?: Identifier;
    /**
     * The choice that was exercised on the target contract.
     * Must be a valid NameString (as described in ``value.proto``).
     * Required
     *
     * @generated from protobuf field: string choice = 6
     */
    choice: string;
    /**
     * The argument of the exercised choice.
     * Required
     *
     * @generated from protobuf field: com.daml.ledger.api.v2.Value choice_argument = 7
     */
    choiceArgument?: Value;
    /**
     * The parties that exercised the choice.
     * Each element must be a valid PartyIdString (as described in ``value.proto``).
     * Required
     *
     * @generated from protobuf field: repeated string acting_parties = 8
     */
    actingParties: string[];
    /**
     * If true, the target contract may no longer be exercised.
     * Required
     *
     * @generated from protobuf field: bool consuming = 9
     */
    consuming: boolean;
    /**
     * The parties that are notified of this event. The witnesses of an exercise
     * node will depend on whether the exercise was consuming or not.
     * If consuming, the witnesses are the union of the stakeholders and
     * the actors.
     * If not consuming, the witnesses are the union of the signatories and
     * the actors. Note that the actors might not necessarily be observers
     * and thus signatories. This is the case when the controllers of a
     * choice are specified using "flexible controllers", using the
     * ``choice ... controller`` syntax, and said controllers are not
     * explicitly marked as observers.
     * Each element must be a valid PartyIdString (as described in ``value.proto``).
     * Required
     *
     * @generated from protobuf field: repeated string witness_parties = 10
     */
    witnessParties: string[];
    /**
     * Specifies the upper boundary of the node ids of the events in the same transaction that appeared as a result of
     * this ``ExercisedEvent``. This allows unambiguous identification of all the members of the subtree rooted at this
     * node. A full subtree can be constructed when all descendant nodes are present in the stream. If nodes are heavily
     * filtered, it is only possible to determine if a node is in a consequent subtree or not.
     * Required
     *
     * @generated from protobuf field: int32 last_descendant_node_id = 11
     */
    lastDescendantNodeId: number;
    /**
     * The result of exercising the choice.
     * Required
     *
     * @generated from protobuf field: com.daml.ledger.api.v2.Value exercise_result = 12
     */
    exerciseResult?: Value;
    /**
     * The package name of the contract.
     * Required
     *
     * @generated from protobuf field: string package_name = 13
     */
    packageName: string;
    /**
     * If the event is consuming, the interfaces implemented by the target template that have been
     * matched from the interface filter query.
     * Populated only in case interface filters with include_interface_view set.
     *
     * The identifier uses the package-id reference format.
     *
     * Optional
     *
     * @generated from protobuf field: repeated com.daml.ledger.api.v2.Identifier implemented_interfaces = 14
     */
    implementedInterfaces: Identifier[];
}
declare class Event$Type extends MessageType<Event> {
    constructor();
    create(value?: PartialMessage<Event>): Event;
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Event): Event;
    internalBinaryWrite(message: Event, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
 * @generated MessageType for protobuf message com.daml.ledger.api.v2.Event
 */
export declare const Event: Event$Type;
declare class CreatedEvent$Type extends MessageType<CreatedEvent> {
    constructor();
    create(value?: PartialMessage<CreatedEvent>): CreatedEvent;
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CreatedEvent): CreatedEvent;
    internalBinaryWrite(message: CreatedEvent, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
 * @generated MessageType for protobuf message com.daml.ledger.api.v2.CreatedEvent
 */
export declare const CreatedEvent: CreatedEvent$Type;
declare class InterfaceView$Type extends MessageType<InterfaceView> {
    constructor();
    create(value?: PartialMessage<InterfaceView>): InterfaceView;
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: InterfaceView): InterfaceView;
    internalBinaryWrite(message: InterfaceView, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
 * @generated MessageType for protobuf message com.daml.ledger.api.v2.InterfaceView
 */
export declare const InterfaceView: InterfaceView$Type;
declare class ArchivedEvent$Type extends MessageType<ArchivedEvent> {
    constructor();
    create(value?: PartialMessage<ArchivedEvent>): ArchivedEvent;
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ArchivedEvent): ArchivedEvent;
    internalBinaryWrite(message: ArchivedEvent, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
 * @generated MessageType for protobuf message com.daml.ledger.api.v2.ArchivedEvent
 */
export declare const ArchivedEvent: ArchivedEvent$Type;
declare class ExercisedEvent$Type extends MessageType<ExercisedEvent> {
    constructor();
    create(value?: PartialMessage<ExercisedEvent>): ExercisedEvent;
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ExercisedEvent): ExercisedEvent;
    internalBinaryWrite(message: ExercisedEvent, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
 * @generated MessageType for protobuf message com.daml.ledger.api.v2.ExercisedEvent
 */
export declare const ExercisedEvent: ExercisedEvent$Type;
export {};
//# sourceMappingURL=event.d.ts.map