// SPDX-License-Identifier: Apache-2.0
import { createFixture } from "../config";
import { HederaIdPropsFixture, PartitionIdFixture } from "../shared/DataFixture";
import { ClearingOperationType, } from "../../../src/domain/context/security/Clearing";
export const ActivateClearingRequestFixture = createFixture((request) => {
    request.securityId.as(() => HederaIdPropsFixture.create().value);
});
export const DeactivateClearingRequestFixture = createFixture((request) => {
    request.securityId.as(() => HederaIdPropsFixture.create().value);
});
export const ClearingTransferByPartitionRequestFixture = createFixture((request) => {
    request.securityId.as(() => HederaIdPropsFixture.create().value);
    request.partitionId.as(() => PartitionIdFixture.create().value);
    request.targetId.as(() => HederaIdPropsFixture.create().value);
    request.amount.faker((faker) => faker.number.int({ min: 1, max: 10 }).toString());
    request.expirationDate.faker((faker) => faker.date.future().getTime().toString());
});
export const ClearingTransferFromByPartitionRequestFixture = createFixture((request) => {
    request.securityId.as(() => HederaIdPropsFixture.create().value);
    request.partitionId.as(() => PartitionIdFixture.create().value);
    request.targetId.as(() => HederaIdPropsFixture.create().value);
    request.sourceId.as(() => HederaIdPropsFixture.create().value);
    request.amount.faker((faker) => faker.number.int({ min: 1, max: 10 }).toString());
    request.expirationDate.faker((faker) => faker.date.future().getTime().toString());
});
export const ProtectedClearingTransferByPartitionRequestFixture = createFixture((request) => {
    request.securityId.as(() => HederaIdPropsFixture.create().value);
    request.partitionId.as(() => PartitionIdFixture.create().value);
    request.sourceId.as(() => HederaIdPropsFixture.create().value);
    request.targetId.as(() => HederaIdPropsFixture.create().value);
    request.amount.faker((faker) => faker.number.int({ min: 1, max: 10 }).toString());
    request.expirationDate.faker((faker) => faker.date.future().getTime().toString());
    request.deadline.faker((faker) => faker.date.future().getTime().toString());
    request.nonce.faker((faker) => faker.number.int({ min: 0, max: 1000 }).toString());
    request.signature.faker((faker) => faker.string.hexadecimal({ length: 64, prefix: "0x" }));
});
export const ApproveClearingOperationByPartitionRequestFixture = createFixture((request) => {
    request.securityId.as(() => HederaIdPropsFixture.create().value);
    request.partitionId.as(() => PartitionIdFixture.create().value);
    request.targetId.as(() => HederaIdPropsFixture.create().value);
    request.clearingId.faker((faker) => faker.number.int({ min: 1, max: 10 }));
    request.clearingOperationType?.faker(() => Object.values(ClearingOperationType));
});
export const CancelClearingOperationByPartitionRequestFixture = createFixture((request) => {
    request.securityId.as(() => HederaIdPropsFixture.create().value);
    request.partitionId.as(() => PartitionIdFixture.create().value);
    request.targetId.as(() => HederaIdPropsFixture.create().value);
    request.clearingId.faker((faker) => faker.number.int({ min: 1, max: 10 }));
    request.clearingOperationType?.faker(() => Object.values(ClearingOperationType));
});
export const ReclaimClearingOperationByPartitionRequestFixture = createFixture((request) => {
    request.securityId.as(() => HederaIdPropsFixture.create().value);
    request.partitionId.as(() => PartitionIdFixture.create().value);
    request.targetId.as(() => HederaIdPropsFixture.create().value);
    request.clearingId.faker((faker) => faker.number.int({ min: 1, max: 10 }));
    request.clearingOperationType?.faker(() => Object.values(ClearingOperationType));
});
export const ClearingRedeemByPartitionRequestFixture = createFixture((request) => {
    request.securityId.as(() => HederaIdPropsFixture.create().value);
    request.partitionId.as(() => PartitionIdFixture.create().value);
    request.amount.faker((faker) => faker.number.int({ min: 1, max: 10 }).toString());
    request.expirationDate.faker((faker) => faker.date.future().getTime().toString());
});
export const ClearingRedeemFromByPartitionRequestFixture = createFixture((request) => {
    request.securityId.as(() => HederaIdPropsFixture.create().value);
    request.sourceId.as(() => HederaIdPropsFixture.create().value);
    request.partitionId.as(() => PartitionIdFixture.create().value);
    request.amount.faker((faker) => faker.number.int({ min: 1, max: 10 }).toString());
    request.expirationDate.faker((faker) => faker.date.future().getTime().toString());
});
export const ProtectedClearingRedeemByPartitionRequestFixture = createFixture((request) => {
    request.securityId.as(() => HederaIdPropsFixture.create().value);
    request.partitionId.as(() => PartitionIdFixture.create().value);
    request.sourceId.as(() => HederaIdPropsFixture.create().value);
    request.amount.faker((faker) => faker.number.int({ min: 1, max: 10 }).toString());
    request.expirationDate.faker((faker) => faker.date.future().getTime().toString());
    request.deadline.faker((faker) => faker.date.future().getTime().toString());
    request.nonce.faker((faker) => faker.number.int({ min: 0, max: 1000 }).toString());
    request.signature.faker((faker) => faker.string.hexadecimal({ length: 64, prefix: "0x" }));
});
export const ClearingCreateHoldByPartitionRequestFixture = createFixture((request) => {
    request.securityId.as(() => HederaIdPropsFixture.create().value);
    request.partitionId.as(() => PartitionIdFixture.create().value);
    request.escrowId.as(() => HederaIdPropsFixture.create().value);
    request.targetId.as(() => HederaIdPropsFixture.create().value);
    request.amount.faker((faker) => faker.number.int({ min: 1, max: 10 }).toString());
    request.clearingExpirationDate.faker((faker) => faker.date.recent().getTime().toString());
    request.holdExpirationDate.faker((faker) => faker.date.future().getTime().toString());
});
export const ClearingCreateHoldFromByPartitionRequestFixture = createFixture((request) => {
    request.securityId.as(() => HederaIdPropsFixture.create().value);
    request.partitionId.as(() => PartitionIdFixture.create().value);
    request.escrowId.as(() => HederaIdPropsFixture.create().value);
    request.sourceId.as(() => HederaIdPropsFixture.create().value);
    request.targetId.as(() => HederaIdPropsFixture.create().value);
    request.amount.faker((faker) => faker.number.int({ min: 1, max: 10 }).toString());
    request.clearingExpirationDate.faker((faker) => faker.date.recent().getTime().toString());
    request.holdExpirationDate.faker((faker) => faker.date.future().getTime().toString());
});
export const ProtectedClearingCreateHoldByPartitionRequestFixture = createFixture((request) => {
    request.securityId.as(() => HederaIdPropsFixture.create().value);
    request.partitionId.as(() => PartitionIdFixture.create().value);
    request.escrowId.as(() => HederaIdPropsFixture.create().value);
    request.sourceId.as(() => HederaIdPropsFixture.create().value);
    request.targetId.as(() => HederaIdPropsFixture.create().value);
    request.amount.faker((faker) => faker.number.int({ min: 1, max: 10 }).toString());
    request.clearingExpirationDate.faker((faker) => faker.date.recent().getTime().toString());
    request.holdExpirationDate.faker((faker) => faker.date.future().getTime().toString());
    request.deadline.faker((faker) => faker.date.future().getTime().toString());
    request.nonce.faker((faker) => faker.number.int({ min: 0, max: 1000 }).toString());
    request.signature.faker((faker) => faker.string.hexadecimal({ length: 64, prefix: "0x" }));
});
export const GetClearedAmountForRequestFixture = createFixture((request) => {
    request.securityId.as(() => HederaIdPropsFixture.create().value);
    request.targetId.as(() => HederaIdPropsFixture.create().value);
});
export const GetClearedAmountForByPartitionRequestFixture = createFixture((request) => {
    request.securityId.as(() => HederaIdPropsFixture.create().value);
    request.partitionId.as(() => PartitionIdFixture.create().value);
    request.targetId.as(() => HederaIdPropsFixture.create().value);
});
export const GetClearingCountForByPartitionRequestFixture = createFixture((request) => {
    request.securityId.as(() => HederaIdPropsFixture.create().value);
    request.partitionId.as(() => PartitionIdFixture.create().value);
    request.targetId.as(() => HederaIdPropsFixture.create().value);
    request.clearingOperationType?.faker(() => Object.values(ClearingOperationType));
});
export const GetClearingCreateHoldForByPartitionRequestFixture = createFixture((request) => {
    request.securityId.as(() => HederaIdPropsFixture.create().value);
    request.partitionId.as(() => PartitionIdFixture.create().value);
    request.targetId.as(() => HederaIdPropsFixture.create().value);
    request.clearingId.faker((faker) => faker.number.int({ min: 0, max: 1000 }).toString());
});
export const GetClearingRedeemForByPartitionRequestFixture = createFixture((request) => {
    request.securityId.as(() => HederaIdPropsFixture.create().value);
    request.partitionId.as(() => PartitionIdFixture.create().value);
    request.targetId.as(() => HederaIdPropsFixture.create().value);
    request.clearingId.faker((faker) => faker.number.int({ min: 0, max: 1000 }).toString());
});
export const GetClearingTransferForByPartitionRequestFixture = createFixture((request) => {
    request.securityId.as(() => HederaIdPropsFixture.create().value);
    request.partitionId.as(() => PartitionIdFixture.create().value);
    request.targetId.as(() => HederaIdPropsFixture.create().value);
    request.clearingId.faker((faker) => faker.number.int({ min: 0, max: 1000 }).toString());
});
export const GetClearingsIdForByPartitionRequestFixture = createFixture((request) => {
    request.securityId.as(() => HederaIdPropsFixture.create().value);
    request.partitionId.as(() => PartitionIdFixture.create().value);
    request.targetId.as(() => HederaIdPropsFixture.create().value);
    request.start.faker((faker) => faker.number.int({ min: 0, max: 1000 }).toString());
    request.end.faker((faker) => faker.number.int({ min: 0, max: 1000 }).toString());
    request.clearingOperationType?.faker(() => Object.values(ClearingOperationType));
});
export const IsClearingActivatedRequestFixture = createFixture((request) => {
    request.securityId.as(() => HederaIdPropsFixture.create().value);
});
export const OperatorClearingCreateHoldByPartitionRequestFixture = createFixture((request) => {
    request.securityId.as(() => HederaIdPropsFixture.create().value);
    request.partitionId.as(() => PartitionIdFixture.create().value);
    request.escrowId.as(() => HederaIdPropsFixture.create().value);
    request.sourceId.as(() => HederaIdPropsFixture.create().value);
    request.targetId.as(() => HederaIdPropsFixture.create().value);
    request.amount.faker((faker) => faker.number.int({ min: 1, max: 10 }).toString());
    request.clearingExpirationDate.faker((faker) => faker.date.recent().getTime().toString());
    request.holdExpirationDate.faker((faker) => faker.date.future().getTime().toString());
});
export const OperatorClearingRedeemByPartitionRequestFixture = createFixture((request) => {
    request.securityId.as(() => HederaIdPropsFixture.create().value);
    request.partitionId.as(() => PartitionIdFixture.create().value);
    request.sourceId.as(() => HederaIdPropsFixture.create().value);
    request.amount.faker((faker) => faker.number.int({ min: 1, max: 10 }).toString());
    request.expirationDate.faker((faker) => faker.date.future().getTime().toString());
});
export const OperatorClearingTransferByPartitionRequestFixture = createFixture((request) => {
    request.securityId.as(() => HederaIdPropsFixture.create().value);
    request.partitionId.as(() => PartitionIdFixture.create().value);
    request.sourceId.as(() => HederaIdPropsFixture.create().value);
    request.targetId.as(() => HederaIdPropsFixture.create().value);
    request.amount.faker((faker) => faker.number.int({ min: 1, max: 10 }).toString());
    request.expirationDate.faker((faker) => faker.date.future().getTime().toString());
});
export const GetClearedAmountForQueryFixture = createFixture((query) => {
    query.securityId.as(() => HederaIdPropsFixture.create().value);
    query.targetId.as(() => HederaIdPropsFixture.create().value);
});
export const GetClearedAmountForByPartitionQueryFixture = createFixture((query) => {
    query.securityId.as(() => HederaIdPropsFixture.create().value);
    query.partitionId.as(() => PartitionIdFixture.create().value);
    query.targetId.as(() => HederaIdPropsFixture.create().value);
});
export const GetClearingCountForByPartitionQueryFixture = createFixture((query) => {
    query.securityId.as(() => HederaIdPropsFixture.create().value);
    query.partitionId.as(() => PartitionIdFixture.create().value);
    query.targetId.as(() => HederaIdPropsFixture.create().value);
    query.clearingOperationType.faker((faker) => faker.helpers.arrayElement(Object.values(ClearingOperationType)));
});
export const IsClearingActivatedQueryFixture = createFixture((query) => {
    query.securityId.as(() => HederaIdPropsFixture.create().value);
});
export const GetClearingCreateHoldForByPartitionQueryFixture = createFixture((query) => {
    query.securityId.as(() => HederaIdPropsFixture.create().value);
    query.partitionId.as(() => PartitionIdFixture.create().value);
    query.targetId.as(() => HederaIdPropsFixture.create().value);
    query.clearingId.faker((faker) => faker.number.int({ min: 1, max: 999 }));
});
export const GetClearingTransferForByPartitionQueryFixture = createFixture((query) => {
    query.securityId.as(() => HederaIdPropsFixture.create().value);
    query.partitionId.as(() => PartitionIdFixture.create().value);
    query.targetId.as(() => HederaIdPropsFixture.create().value);
    query.clearingId.faker((faker) => faker.number.int({ min: 1, max: 999 }));
});
export const GetClearingRedeemForByPartitionQueryFixture = createFixture((query) => {
    query.securityId.as(() => HederaIdPropsFixture.create().value);
    query.partitionId.as(() => PartitionIdFixture.create().value);
    query.targetId.as(() => HederaIdPropsFixture.create().value);
    query.clearingId.faker((faker) => faker.number.int({ min: 1, max: 999 }));
});
export const GetClearingsIdForByPartitionQueryFixture = createFixture((query) => {
    query.securityId.as(() => HederaIdPropsFixture.create().value);
    query.partitionId.as(() => PartitionIdFixture.create().value);
    query.targetId.as(() => HederaIdPropsFixture.create().value);
    query.clearingOperationType.faker((faker) => faker.helpers.arrayElement(Object.values(ClearingOperationType)));
    query.start.faker((faker) => faker.number.int({ min: 1, max: 999 }));
    query.end.faker((faker) => faker.number.int({ min: 1, max: 999 }));
});
export const SwitchClearingModeCommandFixture = createFixture((command) => {
    command.securityId.as(() => HederaIdPropsFixture.create().value);
});
export const HandleClearingOperationByPartitionCommandFixture = createFixture((command) => {
    command.securityId.as(() => HederaIdPropsFixture.create().value);
    command.partitionId.as(() => PartitionIdFixture.create().value);
    command.targetId.as(() => HederaIdPropsFixture.create().value);
    command.clearingId.faker((faker) => faker.number.int({ min: 0, max: 1000 }));
    command.clearingOperationType.faker((faker) => {
        const values = Object.values(ClearingOperationType).filter((v) => typeof v === "number");
        return faker.helpers.arrayElement(values);
    });
});
export const ClearingCreateHoldByPartitionCommandFixture = createFixture((command) => {
    command.securityId.as(() => HederaIdPropsFixture.create().value);
    command.partitionId.as(() => PartitionIdFixture.create().value);
    command.targetId.as(() => HederaIdPropsFixture.create().value);
    command.escrowId.as(() => HederaIdPropsFixture.create().value);
    command.amount.faker((faker) => faker.number.int({ min: 0, max: 1000 }).toString());
    let clearingExpirationDate;
    command.clearingExpirationDate.faker((faker) => {
        clearingExpirationDate = faker.date.future();
        return clearingExpirationDate.getTime().toString();
    });
    command.holdExpirationDate.faker((faker) => faker.date.future().getTime().toString());
    command.sourceId.as(() => HederaIdPropsFixture.create().value);
    command.deadline.faker((faker) => faker.date.future().getTime().toString());
    command.nonce.faker((faker) => faker.number.int({ min: 0, max: 1000 }).toString());
    command.signature.faker((faker) => faker.string.hexadecimal({ length: 64, prefix: "0x" }));
});
export const ClearingRedeemByPartitionCommandFixture = createFixture((command) => {
    command.securityId.as(() => HederaIdPropsFixture.create().value);
    command.partitionId.as(() => PartitionIdFixture.create().value);
    command.amount.faker((faker) => faker.number.int({ min: 0, max: 1000 }).toString());
    command.amount.faker((faker) => faker.number.int({ min: 0, max: 1000 }).toString());
    command.expirationDate.faker((faker) => faker.date.future().getTime().toString());
    command.sourceId.as(() => HederaIdPropsFixture.create().value);
    command.deadline.faker((faker) => faker.date.future().getTime().toString());
    command.nonce.faker((faker) => faker.number.int({ min: 0, max: 1000 }).toString());
    command.signature.faker((faker) => faker.string.hexadecimal({ length: 64, prefix: "0x" }));
});
export const ClearingTransferByPartitionCommandFixture = createFixture((command) => {
    command.securityId.as(() => HederaIdPropsFixture.create().value);
    command.partitionId.as(() => PartitionIdFixture.create().value);
    command.amount.faker((faker) => faker.number.int({ min: 0, max: 1000 }).toString());
    command.amount.faker((faker) => faker.number.int({ min: 0, max: 1000 }).toString());
    command.expirationDate.faker((faker) => faker.date.future().getTime().toString());
    command.sourceId.as(() => HederaIdPropsFixture.create().value);
    command.targetId.as(() => HederaIdPropsFixture.create().value);
    command.deadline.faker((faker) => faker.date.future().getTime().toString());
    command.nonce.faker((faker) => faker.number.int({ min: 0, max: 1000 }).toString());
    command.signature.faker((faker) => faker.string.hexadecimal({ length: 64, prefix: "0x" }));
});
export const ClearingHoldCreationFixture = createFixture((props) => {
    props.amount.faker((faker) => BigInt(faker.number.int({ max: 999 })).toString());
    props.expirationTimestamp.faker((faker) => faker.date.future());
    props.data.faker((faker) => faker.lorem.words());
    props.operatorData.faker((faker) => faker.lorem.words());
    props.holdEscrowId.as(() => HederaIdPropsFixture.create().value);
    props.holdExpirationTimestamp.faker((faker) => faker.date.future());
    props.holdTo.as(() => HederaIdPropsFixture.create().value);
    props.holdData.faker((faker) => faker.lorem.words());
});
export const ClearingRedeemFixture = createFixture((props) => {
    props.amount.faker((faker) => BigInt(faker.number.int({ max: 999 })).toString());
    props.expirationTimestamp.faker((faker) => faker.date.future());
    props.data.faker((faker) => faker.lorem.words());
    props.operatorData.faker((faker) => faker.lorem.words());
});
export const ClearingTransferFixture = createFixture((props) => {
    props.amount.faker((faker) => BigInt(faker.number.int({ max: 999 })).toString());
    props.expirationTimestamp.faker((faker) => faker.date.future());
    props.data.faker((faker) => faker.lorem.words());
    props.operatorData.faker((faker) => faker.lorem.words());
    props.destination.as(() => HederaIdPropsFixture.create().value);
});
