import { CellKey as CellKey_internal } from "./CellKey";
import { IgcPrimaryKeyValue } from './igc-primary-key-value';
import { IgcColumnComponent } from './igc-column-component';
/**
 * An indentifier for a specific cell in the grid.
*/
export class IgcCellKey {
    get i() {
        return this._implementation;
    }
    onImplementationCreated() {
    }
    constructor() {
        this._implementation = new CellKey_internal();
        this._implementation.externalObject = this;
    }
    _provideImplementation(i) {
        this._implementation = i;
        this._implementation.externalObject = this;
        this.onImplementationCreated();
    }
    /**
     * Gets or sets the primary key of the row associated with the cell.
    */
    get primaryKey() {
        if (this.i.primaryKey == null) {
            return null;
        }
        if (!this._primaryKey) {
            this._primaryKey = new IgcPrimaryKeyValue(this.i.primaryKey.key, this.i.primaryKey.value);
        }
        return this._primaryKey;
    }
    set primaryKey(v) {
        this.i.primaryKey = v.i;
    }
    /**
 * Gets or sets the row data object associated with the cell.
*/
    get rowItem() {
        return this.i.h;
    }
    set rowItem(v) {
        this.i.h = v;
    }
    /**
     * Gets or sets the column name associated with the cell.
     * All columns in the grid must have a unique name. That unique name is what is used for this property.
    */
    get columnUniqueKey() {
        return this.i.j;
    }
    set columnUniqueKey(v) {
        this.i.j = v;
    }
    /**
     * Gets or sets the resolved column object associated with this cell.
    */
    get resolvedColumn() {
        if (this.i.b == null) {
            return null;
        }
        if (!this.i.b.externalObject) {
            let e = IgcColumnComponent._createFromInternal(this.i.b);
            if (e) {
                e._implementation = this.i.b;
            }
            this.i.b.externalObject = e;
        }
        return this.i.b.externalObject;
    }
    findByName(name) {
        if (this.primaryKey && this.primaryKey.name && this.primaryKey.name == name) {
            return this.primaryKey;
        }
        return null;
    }
}
//# sourceMappingURL=igc-cell-key.js.map
