"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.FloatingMatchSettingsData = void 0;
const utils = __importStar(require("@applitools/utils"));
const Region_1 = require("./Region");
/** @undocumented */
class FloatingMatchSettingsData {
    constructor(settingsOrRegionOrX, y, width, height, maxUpOffset, maxDownOffset, maxLeftOffset, maxRightOffset) {
        let settings;
        if (utils.types.isNumber(settingsOrRegionOrX)) {
            settings = {
                region: { x: settingsOrRegionOrX, y: y, width: width, height: height },
                maxUpOffset,
                maxDownOffset,
                maxLeftOffset,
                maxRightOffset,
            };
        }
        else if (!utils.types.has(settingsOrRegionOrX, 'region')) {
            settings = { region: settingsOrRegionOrX };
        }
        else {
            settings = settingsOrRegionOrX;
        }
        this._settings = settings;
    }
    get region() {
        return this._settings.region;
    }
    set region(region) {
        utils.guard.isObject(region, { name: 'region' });
        this._settings.region = new Region_1.RegionData(region);
    }
    getRegion() {
        return new Region_1.RegionData(this.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 maxUpOffset() {
        return this._settings.maxUpOffset;
    }
    set maxUpOffset(maxUpOffset) {
        utils.guard.isNumber(maxUpOffset, { name: 'maxUpOffset' });
        this._settings.maxUpOffset = maxUpOffset;
    }
    getMaxUpOffset() {
        return this.maxUpOffset;
    }
    setMaxUpOffset(maxUpOffset) {
        this.maxUpOffset = maxUpOffset;
    }
    get maxDownOffset() {
        return this._settings.maxDownOffset;
    }
    set maxDownOffset(maxDownOffset) {
        utils.guard.isNumber(maxDownOffset, { name: 'maxDownOffset' });
        this._settings.maxDownOffset = maxDownOffset;
    }
    getMaxDownOffset() {
        return this.maxDownOffset;
    }
    setMaxDownOffset(maxDownOffset) {
        this.maxDownOffset = maxDownOffset;
    }
    get maxLeftOffset() {
        return this._settings.maxLeftOffset;
    }
    set maxLeftOffset(maxLeftOffset) {
        utils.guard.isNumber(maxLeftOffset, { name: 'maxLeftOffset' });
        this._settings.maxLeftOffset = maxLeftOffset;
    }
    getMaxLeftOffset() {
        return this.maxLeftOffset;
    }
    setMaxLeftOffset(maxLeftOffset) {
        this.maxLeftOffset = maxLeftOffset;
    }
    get maxRightOffset() {
        return this._settings.maxRightOffset;
    }
    set maxRightOffset(maxRightOffset) {
        utils.guard.isNumber(maxRightOffset, { name: 'maxRightOffset' });
        this._settings.maxRightOffset = maxRightOffset;
    }
    getMaxRightOffset() {
        return this.maxRightOffset;
    }
    setMaxRightOffset(maxRightOffset) {
        this.maxRightOffset = maxRightOffset;
    }
    /** @internal */
    toObject() {
        return this._settings;
    }
    /** @internal */
    toJSON() {
        return utils.general.toJSON(this._settings);
    }
    /** @internal */
    toString() {
        return utils.general.toString(this);
    }
}
exports.FloatingMatchSettingsData = FloatingMatchSettingsData;
