"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AccessibilityMatchSettingsData = void 0;
const utils = __importStar(require("@applitools/utils"));
const AccessibilityRegionType_1 = require("../enums/AccessibilityRegionType");
const Region_1 = require("./Region");
class AccessibilityMatchSettingsData {
    constructor(settingsOrRegionOrX, y, width, height, type) {
        let settings;
        if (utils.types.isNumber(settingsOrRegionOrX)) {
            settings = { region: { x: settingsOrRegionOrX, y: y, width: width, height: height }, type };
        }
        else if (!utils.types.has(settingsOrRegionOrX, 'region')) {
            settings = { region: settingsOrRegionOrX };
        }
        else {
            settings = settingsOrRegionOrX;
        }
        utils.guard.isEnumValue(settings.type, AccessibilityRegionType_1.AccessibilityRegionTypeEnum, { name: 'type', strict: false });
        utils.guard.isObject(settings.region, { name: 'region' });
        this._settings = settings;
    }
    get region() {
        return this._settings.region;
    }
    set region(region) {
        utils.guard.isObject(region, { name: 'region' });
        this._settings.region = region;
    }
    getRegion() {
        return new Region_1.RegionData(this._settings.region);
    }
    setRegion(region) {
        this.region = region;
    }
    getLeft() {
        return this.region.x;
    }
    setLeft(left) {
        this.region.x = left;
    }
    getTop() {
        return this.region.y;
    }
    setTop(top) {
        this.region.y = top;
    }
    getWidth() {
        return this.region.width;
    }
    setWidth(width) {
        this.region.width = width;
    }
    getHeight() {
        return this.region.height;
    }
    setHeight(height) {
        this.region.height = height;
    }
    get type() {
        return this._settings.type;
    }
    set type(type) {
        utils.guard.isEnumValue(type, AccessibilityRegionType_1.AccessibilityRegionTypeEnum, { name: 'type', strict: false });
        this._settings.type = type;
    }
    getType() {
        return this.type;
    }
    setType(type) {
        this.type = type;
    }
    /** @internal */
    toObject() {
        return this._settings;
    }
    /** @internal */
    toJSON() {
        return utils.general.toJSON(this._settings);
    }
    /** @internal */
    toString() {
        return utils.general.toString(this);
    }
}
exports.AccessibilityMatchSettingsData = AccessibilityMatchSettingsData;
