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 { CreatedEvent } from './event.js';
import { Identifier } from './value.js';
import { Timestamp } from '../../../../../google/protobuf/timestamp.js';
import { TraceContext } from './trace_context.js';
/**
 * Complete view of an on-ledger reassignment.
 *
 * @generated from protobuf message com.daml.ledger.api.v2.Reassignment
 */
export interface Reassignment {
    /**
     * Assigned by the server. Useful for correlating logs.
     * Must be a valid LedgerString (as described in ``value.proto``).
     * Required
     *
     * @generated from protobuf field: string update_id = 1
     */
    updateId: string;
    /**
     * The ID of the command which resulted in this reassignment. Missing for everyone except the submitting party on the submitting participant.
     * Must be a valid LedgerString (as described in ``value.proto``).
     * Optional
     *
     * @generated from protobuf field: string command_id = 2
     */
    commandId: string;
    /**
     * The workflow ID used in reassignment command submission. Only set if the ``workflow_id`` for the command was set.
     * Must be a valid LedgerString (as described in ``value.proto``).
     * Optional
     *
     * @generated from protobuf field: string workflow_id = 3
     */
    workflowId: string;
    /**
     * The participant's offset. The details of this field are described in ``community/ledger-api/README.md``.
     * Required, must be a valid absolute offset (positive integer).
     *
     * @generated from protobuf field: int64 offset = 4
     */
    offset: bigint;
    /**
     * The collection of reassignment events. Required.
     *
     * @generated from protobuf field: repeated com.daml.ledger.api.v2.ReassignmentEvent events = 5
     */
    events: ReassignmentEvent[];
    /**
     * Optional; ledger API trace context
     *
     * The trace context transported in this message corresponds to the trace context supplied
     * by the client application in a HTTP2 header of the original command submission.
     * We typically use a header to transfer this type of information. Here we use message
     * body, because it is used in gRPC streams which do not support per message headers.
     * This field will be populated with the trace context contained in the original submission.
     * If that was not provided, a unique ledger-api-server generated trace context will be used
     * instead.
     *
     * @generated from protobuf field: com.daml.ledger.api.v2.TraceContext trace_context = 6
     */
    traceContext?: TraceContext;
    /**
     * The time at which the reassignment was recorded. The record time refers to the source/target
     * synchronizer for an unassign/assign event respectively.
     * Required
     *
     * @generated from protobuf field: google.protobuf.Timestamp record_time = 7
     */
    recordTime?: Timestamp;
}
/**
 * @generated from protobuf message com.daml.ledger.api.v2.ReassignmentEvent
 */
export interface ReassignmentEvent {
    /**
     * @generated from protobuf oneof: event
     */
    event: {
        oneofKind: 'unassigned';
        /**
         * @generated from protobuf field: com.daml.ledger.api.v2.UnassignedEvent unassigned = 1
         */
        unassigned: UnassignedEvent;
    } | {
        oneofKind: 'assigned';
        /**
         * @generated from protobuf field: com.daml.ledger.api.v2.AssignedEvent assigned = 2
         */
        assigned: AssignedEvent;
    } | {
        oneofKind: undefined;
    };
}
/**
 * Records that a contract has been unassigned, and it becomes unusable on the source synchronizer
 *
 * @generated from protobuf message com.daml.ledger.api.v2.UnassignedEvent
 */
export interface UnassignedEvent {
    /**
     * The ID of the unassignment. This needs to be used as an input for a assign ReassignmentCommand.
     * For one contract the (unassign_id, source synchronizer) pair is unique.
     * Must be a valid LedgerString (as described in ``value.proto``).
     * Required
     *
     * @generated from protobuf field: string unassign_id = 1
     */
    unassignId: string;
    /**
     * The ID of the reassigned contract.
     * Must be a valid LedgerString (as described in ``value.proto``).
     * Required
     *
     * @generated from protobuf field: string contract_id = 2
     */
    contractId: string;
    /**
     * The template of the reassigned contract.
     * The identifier uses the package-id reference format.
     *
     * Required
     *
     * @generated from protobuf field: com.daml.ledger.api.v2.Identifier template_id = 3
     */
    templateId?: Identifier;
    /**
     * The ID of the source synchronizer
     * Must be a valid synchronizer id
     * Required
     *
     * @generated from protobuf field: string source = 4
     */
    source: string;
    /**
     * The ID of the target synchronizer
     * Must be a valid synchronizer id
     * Required
     *
     * @generated from protobuf field: string target = 5
     */
    target: string;
    /**
     * Party on whose behalf the unassign command was executed.
     * Empty if the unassignment happened offline via the repair service.
     * Must be a valid PartyIdString (as described in ``value.proto``).
     * Optional
     *
     * @generated from protobuf field: string submitter = 6
     */
    submitter: string;
    /**
     * Each corresponding assigned and unassigned event has the same reassignment_counter. This strictly increases
     * with each unassign command for the same contract. Creation of the contract corresponds to reassignment_counter
     * equals zero.
     * Required
     *
     * @generated from protobuf field: uint64 reassignment_counter = 7
     */
    reassignmentCounter: bigint;
    /**
     * Assignment exclusivity
     * Before this time (measured on the target synchronizer), only the submitter of the unassignment can initiate the assignment
     * Defined for reassigning participants.
     * Optional
     *
     * @generated from protobuf field: google.protobuf.Timestamp assignment_exclusivity = 8
     */
    assignmentExclusivity?: Timestamp;
    /**
     * The parties that are notified of this event.
     * Required
     *
     * @generated from protobuf field: repeated string witness_parties = 9
     */
    witnessParties: string[];
    /**
     * The package name of the contract.
     * Required
     *
     * @generated from protobuf field: string package_name = 10
     */
    packageName: string;
    /**
     * The offset of origin.
     * Offsets are managed by the participant nodes.
     * Reassignments 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 = 11
     */
    offset: bigint;
    /**
     * The position of this event in the originating reassignment.
     * Node IDs are not necessarily equal across participants,
     * as these may see different projections/parts of reassignments.
     * Required, must be valid node ID (non-negative integer)
     *
     * @generated from protobuf field: int32 node_id = 12
     */
    nodeId: number;
}
/**
 * Records that a contract has been assigned, and it can be used on the target synchronizer.
 *
 * @generated from protobuf message com.daml.ledger.api.v2.AssignedEvent
 */
export interface AssignedEvent {
    /**
     * The ID of the source synchronizer.
     * Must be a valid synchronizer id.
     * Required
     *
     * @generated from protobuf field: string source = 1
     */
    source: string;
    /**
     * The ID of the target synchronizer.
     * Must be a valid synchronizer id.
     * Required
     *
     * @generated from protobuf field: string target = 2
     */
    target: string;
    /**
     * The ID from the unassigned event.
     * For correlation capabilities.
     * For one contract the (unassign_id, source synchronizer) pair is unique.
     * Must be a valid LedgerString (as described in ``value.proto``).
     * Required
     *
     * @generated from protobuf field: string unassign_id = 3
     */
    unassignId: string;
    /**
     * Party on whose behalf the assign command was executed.
     * Empty if the assignment happened offline via the repair service.
     * Must be a valid PartyIdString (as described in ``value.proto``).
     * Optional
     *
     * @generated from protobuf field: string submitter = 4
     */
    submitter: string;
    /**
     * Each corresponding assigned and unassigned event has the same reassignment_counter. This strictly increases
     * with each unassign command for the same contract. Creation of the contract corresponds to reassignment_counter
     * equals zero.
     * Required
     *
     * @generated from protobuf field: uint64 reassignment_counter = 5
     */
    reassignmentCounter: bigint;
    /**
     * Required
     * The offset of this event refers to the offset of the assignment,
     * while the node_id is the index of within the batch.
     *
     * @generated from protobuf field: com.daml.ledger.api.v2.CreatedEvent created_event = 6
     */
    createdEvent?: CreatedEvent;
}
declare class Reassignment$Type extends MessageType<Reassignment> {
    constructor();
    create(value?: PartialMessage<Reassignment>): Reassignment;
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: Reassignment): Reassignment;
    internalBinaryWrite(message: Reassignment, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
 * @generated MessageType for protobuf message com.daml.ledger.api.v2.Reassignment
 */
export declare const Reassignment: Reassignment$Type;
declare class ReassignmentEvent$Type extends MessageType<ReassignmentEvent> {
    constructor();
    create(value?: PartialMessage<ReassignmentEvent>): ReassignmentEvent;
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ReassignmentEvent): ReassignmentEvent;
    internalBinaryWrite(message: ReassignmentEvent, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
 * @generated MessageType for protobuf message com.daml.ledger.api.v2.ReassignmentEvent
 */
export declare const ReassignmentEvent: ReassignmentEvent$Type;
declare class UnassignedEvent$Type extends MessageType<UnassignedEvent> {
    constructor();
    create(value?: PartialMessage<UnassignedEvent>): UnassignedEvent;
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: UnassignedEvent): UnassignedEvent;
    internalBinaryWrite(message: UnassignedEvent, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
 * @generated MessageType for protobuf message com.daml.ledger.api.v2.UnassignedEvent
 */
export declare const UnassignedEvent: UnassignedEvent$Type;
declare class AssignedEvent$Type extends MessageType<AssignedEvent> {
    constructor();
    create(value?: PartialMessage<AssignedEvent>): AssignedEvent;
    internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: AssignedEvent): AssignedEvent;
    internalBinaryWrite(message: AssignedEvent, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
}
/**
 * @generated MessageType for protobuf message com.daml.ledger.api.v2.AssignedEvent
 */
export declare const AssignedEvent: AssignedEvent$Type;
export {};
//# sourceMappingURL=reassignment.d.ts.map