import { UmbStoreBase } from '../store-base.js';
import { UmbArrayState } from '../../../../libs/observable-api/index.js';
/**
 * @class UmbDetailStoreBase
 * @augments {UmbStoreBase}
 * @description - Data Store for Data Type items
 */
export class UmbDetailStoreBase extends UmbStoreBase {
    /**
     * Creates an instance of UmbDetailStoreBase.
     * @param {UmbControllerHost} host - The controller host for this controller to be appended to
     * @param storeAlias - The alias of the store
     * @memberof UmbDetailStoreBase
     */
    constructor(host, storeAlias) {
        super(host, storeAlias, new UmbArrayState([], (x) => x.unique));
    }
    /**
     * Retrieve a detail model from the store
     * @param {unique} string unique identifier
     * @param unique
     * @returns {Observable<T>}
     * @memberof UmbDetailStoreBase
     */
    byUnique(unique) {
        return this._data.asObservablePart((x) => x.find((y) => y.unique === unique));
    }
    /**
     * Retrieve multiple detail models from the store
     * @param {Array<string>} uniques - Array of unique identifiers
     * @returns {Observable<Array<T>>}
     * @memberof UmbDetailStoreBase
     */
    byUniques(uniques) {
        return this._data.asObservablePart((x) => x.filter((y) => y.unique !== null && uniques.includes(y.unique)));
    }
}
