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