"use strict";
// SPDX-License-Identifier: Apache-2.0
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LockOperations = void 0;
const asset_tokenization_contracts_1 = require("@hashgraph/asset-tokenization-contracts");
const Constants_1 = require("../../../../core/Constants");
const LogService_1 = __importDefault(require("../../../../app/service/log/LogService"));
class LockOperations {
    executor;
    constructor(executor) {
        this.executor = executor;
    }
    async lock(security, sourceId, amount, expirationDate, securityId) {
        LogService_1.default.logTrace(`Locking ${amount} tokens from account ${sourceId.toString()} until ${expirationDate}`);
        return this.executor.executeContractCall(securityId.toString(), asset_tokenization_contracts_1.LockFacet__factory.createInterface(), "lockByPartition", [Constants_1._PARTITION_ID_1, amount.toHexString(), sourceId.toString(), expirationDate.toHexString()], Constants_1.GAS.LOCK);
    }
    async release(security, sourceId, lockId, securityId) {
        LogService_1.default.logTrace(`Releasing lock ${lockId} from account ${sourceId.toString()}`);
        return this.executor.executeContractCall(securityId.toString(), asset_tokenization_contracts_1.LockFacet__factory.createInterface(), "releaseByPartition", [Constants_1._PARTITION_ID_1, lockId.toHexString(), sourceId.toString()], Constants_1.GAS.RELEASE);
    }
}
exports.LockOperations = LockOperations;
