// #region Imports
import { GridLength } from './GridLength';
/**
 * Represents a single row track definition in a grid layout.
 *
 * A `RowDefinition` pairs a `GridLength` height with optional
 * minimum / maximum pixel constraints. During layout the resolved track
 * height is clamped to `[minHeight, maxHeight]`.
 *
 * **Validation rules**
 * - `minHeight` and `maxHeight` must be non-negative.
 * - `minHeight` must not exceed `maxHeight`.
 *
 * @example
 * ```ts
 * // 100 px fixed row
 * new RowDefinition(new GridLength(100, 'pixel'));
 *
 * // Star row (proportional) clamped between 40 px and 200 px
 * new RowDefinition(new GridLength(1, 'star'), 40, 200);
 *
 * // Auto row – height determined by content
 * new RowDefinition(new GridLength(1, 'auto'));
 * ```
 *
 * @public
 */
export class RowDefinition {
    // #region Fields
    _height;
    _minHeight;
    _maxHeight;
    // #endregion
    // #region Ctor
    /**
     * Constructs a new instance of the `RowDefinition` class.
     *
     * @public
     * @param height The height specification. Defaults to `1*` (one star).
     * @param minHeight Minimum height in pixels/DIPs. Must be ≥ 0. Defaults to `0`.
     * @param maxHeight Maximum height in pixels/DIPs. Must be ≥ 0 and ≥ `minHeight`. Defaults to `Number.MAX_SAFE_INTEGER` (unbounded).
     * @throws {Error} If `minHeight` is negative.
     * @throws {Error} If `maxHeight` is negative.
     * @throws {Error} If `minHeight` exceeds `maxHeight`.
     */
    constructor(height = new GridLength(1, 'star'), minHeight = 0, maxHeight = Number.MAX_SAFE_INTEGER) {
        if (minHeight < 0) {
            throw new Error(`RowDefinition minHeight must be non-negative. Received: ${minHeight}`);
        }
        if (maxHeight < 0) {
            throw new Error(`RowDefinition maxHeight must be non-negative. Received: ${maxHeight}`);
        }
        if (minHeight > maxHeight) {
            throw new Error(`RowDefinition minHeight (${minHeight}) must not exceed maxHeight (${maxHeight}).`);
        }
        this._height = height instanceof GridLength
            ? height
            : new GridLength(height.value, height.type);
        this._minHeight = minHeight;
        this._maxHeight = maxHeight;
    }
    // #endregion
    // #region Properties
    /**
     * Gets or sets the height specification for this row.
     *
     * @public
     */
    get height() {
        return this._height;
    }
    set height(value) {
        this._height = value;
    }
    /**
     * Gets or sets the minimum height in pixels/DIPs.
     *
     * @public
     * @throws {Error} If the new value is negative.
     */
    get minHeight() {
        return this._minHeight;
    }
    set minHeight(value) {
        if (value < 0) {
            throw new Error(`RowDefinition minHeight must be non-negative. Received: ${value}`);
        }
        this._minHeight = value;
    }
    /**
     * Gets or sets the maximum height in pixels/DIPs.
     *
     * @public
     * @throws {Error} If the new value is negative.
     */
    get maxHeight() {
        return this._maxHeight;
    }
    set maxHeight(value) {
        if (value < 0) {
            throw new Error(`RowDefinition maxHeight must be non-negative. Received: ${value}`);
        }
        this._maxHeight = value;
    }
}
//# sourceMappingURL=RowDefinition.js.map