"use strict";
// SPDX-License-Identifier: Apache-2.0
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const OptionalDecorator_1 = require("../../../../core/decorator/OptionalDecorator");
const Equity_1 = require("../../../../domain/context/equity/Equity");
const Security_1 = require("../../../../domain/context/security/Security");
const ValidatedArgs_1 = __importDefault(require("../../../../core/validation/ValidatedArgs"));
const FormatValidation_1 = __importDefault(require("../FormatValidation"));
const Factories_1 = require("../../../../domain/context/factory/Factories");
class CreateEquityRequest extends ValidatedArgs_1.default {
    name;
    symbol;
    isin;
    _decimals;
    get decimals() {
        return this._decimals;
    }
    set decimals(value) {
        this._decimals = typeof value === "number" ? value : parseFloat(value);
    }
    isWhiteList;
    erc20VotesActivated;
    isControllable;
    arePartitionsProtected;
    isMultiPartition;
    clearingActive;
    internalKycActivated;
    externalPausesIds;
    externalControlListsIds;
    externalKycListsIds;
    diamondOwnerAccount;
    complianceId;
    identityRegistryId;
    votingRight;
    informationRight;
    liquidationRight;
    subscriptionRight;
    conversionRight;
    redemptionRight;
    putRight;
    dividendRight;
    currency;
    numberOfShares;
    nominalValue;
    nominalValueDecimals;
    regulationType;
    regulationSubType;
    isCountryControlListWhiteList;
    countries;
    info;
    configId;
    configVersion;
    constructor({ name, symbol, isin, decimals, isWhiteList, erc20VotesActivated, isControllable, arePartitionsProtected, isMultiPartition, clearingActive, internalKycActivated, externalPausesIds, externalControlListsIds, externalKycListsIds, diamondOwnerAccount, votingRight, informationRight, liquidationRight, subscriptionRight, conversionRight, redemptionRight, putRight, dividendRight, currency, numberOfShares, nominalValue, nominalValueDecimals, regulationType, regulationSubType, isCountryControlListWhiteList, countries, info, configId, configVersion, complianceId, identityRegistryId, }) {
        super({
            name: (val) => {
                return Security_1.Security.checkName(val);
            },
            symbol: (val) => {
                return Security_1.Security.checkSymbol(val);
            },
            isin: (val) => {
                return Security_1.Security.checkISIN(val);
            },
            decimals: (val) => {
                return Security_1.Security.checkInteger(val);
            },
            diamondOwnerAccount: FormatValidation_1.default.checkHederaIdFormatOrEvmAddress(false),
            dividendRight: (val) => {
                return Equity_1.Equity.checkDividend(val);
            },
            currency: FormatValidation_1.default.checkBytes3Format(),
            numberOfShares: FormatValidation_1.default.checkNumber(),
            nominalValue: FormatValidation_1.default.checkNumber(),
            regulationType: (val) => {
                return Factories_1.Factory.checkRegulationType(val);
            },
            regulationSubType: (val) => {
                return Factories_1.Factory.checkRegulationSubType(val, this.regulationType);
            },
            configId: FormatValidation_1.default.checkBytes32Format(),
            externalPausesIds: (val) => {
                return FormatValidation_1.default.checkHederaIdOrEvmAddressArray(val ?? [], "externalPausesIds", true);
            },
            externalControlListsIds: (val) => {
                return FormatValidation_1.default.checkHederaIdOrEvmAddressArray(val ?? [], "externalControlListsIds", true);
            },
            externalKycListsIds: (val) => {
                return FormatValidation_1.default.checkHederaIdOrEvmAddressArray(val ?? [], "externalKycListsIds", true);
            },
            complianceId: FormatValidation_1.default.checkHederaIdFormatOrEvmAddress(true),
            identityRegistryId: FormatValidation_1.default.checkHederaIdFormatOrEvmAddress(true),
        });
        this.name = name;
        this.symbol = symbol;
        this.isin = isin;
        this.decimals = typeof decimals === "number" ? decimals : parseInt(decimals);
        this.isWhiteList = isWhiteList;
        this.erc20VotesActivated = erc20VotesActivated;
        this.isControllable = isControllable;
        this.arePartitionsProtected = arePartitionsProtected;
        this.isMultiPartition = isMultiPartition;
        this.clearingActive = clearingActive;
        this.internalKycActivated = internalKycActivated;
        this.externalPausesIds = externalPausesIds;
        this.diamondOwnerAccount = diamondOwnerAccount;
        this.externalControlListsIds = externalControlListsIds;
        this.externalKycListsIds = externalKycListsIds;
        this.votingRight = votingRight;
        this.informationRight = informationRight;
        this.liquidationRight = liquidationRight;
        this.subscriptionRight = subscriptionRight;
        this.conversionRight = conversionRight;
        this.redemptionRight = redemptionRight;
        this.putRight = putRight;
        this.dividendRight = dividendRight;
        this.currency = currency;
        this.numberOfShares = numberOfShares;
        this.nominalValue = nominalValue;
        this.nominalValueDecimals = nominalValueDecimals;
        this.regulationType = regulationType;
        this.regulationSubType = regulationSubType;
        this.isCountryControlListWhiteList = isCountryControlListWhiteList;
        this.countries = countries;
        this.info = info;
        this.configId = configId;
        this.configVersion = configVersion;
        this.complianceId = complianceId;
        this.identityRegistryId = identityRegistryId;
    }
}
exports.default = CreateEquityRequest;
__decorate([
    (0, OptionalDecorator_1.OptionalField)(),
    __metadata("design:type", Array)
], CreateEquityRequest.prototype, "externalPausesIds", void 0);
__decorate([
    (0, OptionalDecorator_1.OptionalField)(),
    __metadata("design:type", Array)
], CreateEquityRequest.prototype, "externalControlListsIds", void 0);
__decorate([
    (0, OptionalDecorator_1.OptionalField)(),
    __metadata("design:type", Array)
], CreateEquityRequest.prototype, "externalKycListsIds", void 0);
__decorate([
    (0, OptionalDecorator_1.OptionalField)(),
    __metadata("design:type", String)
], CreateEquityRequest.prototype, "diamondOwnerAccount", void 0);
__decorate([
    (0, OptionalDecorator_1.OptionalField)(),
    __metadata("design:type", String)
], CreateEquityRequest.prototype, "complianceId", void 0);
__decorate([
    (0, OptionalDecorator_1.OptionalField)(),
    __metadata("design:type", String)
], CreateEquityRequest.prototype, "identityRegistryId", void 0);
