"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.GetSecurityQueryFixture = exports.SecurityPropsFixture = void 0;
const config_1 = require("../config");
const SecurityType_1 = require("../../../src/domain/context/factory/SecurityType");
const BigDecimal_1 = __importDefault(require("../../../src/domain/context/shared/BigDecimal"));
const RegulationType_1 = require("../../../src/domain/context/factory/RegulationType");
const RegulationFixture_1 = require("./RegulationFixture");
const DataFixture_1 = require("./DataFixture");
const EvmAddress_1 = __importDefault(require("../../../src/domain/context/contract/EvmAddress"));
const HederaId_1 = require("../../../src/domain/context/shared/HederaId");
const faker_1 = require("@faker-js/faker");
exports.SecurityPropsFixture = (0, config_1.createFixture)((security) => {
    security.name.faker((faker) => faker.company.name());
    security.symbol.faker((faker) => faker.string.alpha({ length: 3, casing: "upper" }));
    security.isin.faker((faker) => `US${faker.string.numeric(9)}`);
    security.type?.faker((faker) => faker.helpers.arrayElement(Object.values(SecurityType_1.SecurityType)));
    security.decimals.faker((faker) => faker.number.int({ min: 0, max: 18 }));
    security.isWhiteList.faker((faker) => faker.datatype.boolean());
    security.erc20VotesActivated?.faker((faker) => faker.datatype.boolean());
    security.isControllable.faker((faker) => faker.datatype.boolean());
    security.arePartitionsProtected.faker((faker) => faker.datatype.boolean());
    security.clearingActive.faker((faker) => faker.datatype.boolean());
    security.internalKycActivated.faker((faker) => faker.datatype.boolean());
    security.isMultiPartition.faker((faker) => faker.datatype.boolean());
    security.isIssuable?.faker((faker) => faker.datatype.boolean());
    security.totalSupply?.faker((faker) => BigDecimal_1.default.fromString(faker.finance.amount({ min: 1000, max: 1000000, dec: 0 })));
    security.maxSupply?.faker((faker) => BigDecimal_1.default.fromString(faker.finance.amount({ min: 1000000, max: 10000000, dec: 0 })));
    security.diamondAddress?.as(() => new HederaId_1.HederaId(DataFixture_1.HederaIdPropsFixture.create().value));
    security.evmDiamondAddress?.as(() => new EvmAddress_1.default(DataFixture_1.EvmAddressPropsFixture.create().value));
    security.paused?.faker((faker) => faker.datatype.boolean());
    const regulationType = faker_1.faker.helpers.arrayElement(Object.values(RegulationType_1.RegulationType).filter((type) => type !== RegulationType_1.RegulationType.NONE));
    security.regulationType?.as(() => regulationType);
    security.regulationsubType?.faker((faker) => regulationType === RegulationType_1.RegulationType.REG_S
        ? RegulationType_1.RegulationSubType.NONE
        : faker.helpers.arrayElement(Object.values(RegulationType_1.RegulationSubType).filter((subType) => subType !== RegulationType_1.RegulationSubType.NONE)));
    security.regulation?.fromFixture(RegulationFixture_1.RegulationFixture);
    security.isCountryControlListWhiteList.faker((faker) => faker.datatype.boolean());
    security.countries?.faker((faker) => faker.helpers
        .arrayElements(Array.from({ length: 5 }, () => faker.location.countryCode({ variant: "alpha-2" })), { min: 1, max: 5 })
        .join(","));
    security.info?.faker((faker) => faker.lorem.sentence());
});
exports.GetSecurityQueryFixture = (0, config_1.createFixture)((query) => {
    query.securityId.as(() => DataFixture_1.HederaIdPropsFixture.create().value);
});
