var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { UMB_COLLECTION_CONTEXT } from '../../../../../../../core/collection/index.js';
import { css, html, customElement, state } from '../../../../../../../../external/lit/index.js';
import { UmbTextStyles } from '../../../../../../../core/style/index.js';
import { UmbLitElement } from '../../../../../../../core/lit-element/index.js';
import { UmbIsTrashedEntityContext } from '../../../../../../../core/recycle-bin/index.js';
import './trashed-media-name-table-column.element.js';
let UmbMediaRecycleBinTreeItemTableCollectionViewElement = class UmbMediaRecycleBinTreeItemTableCollectionViewElement extends UmbLitElement {
    #collectionContext;
    #isTrashedContext;
    constructor() {
        super();
        this._tableConfig = {
            allowSelection: false,
        };
        this._tableColumns = [
            {
                name: this.localize.term('general_name'),
                alias: 'name',
                elementName: 'umb-trashed-media-name-table-column',
            },
            {
                name: '',
                alias: 'entityActions',
                align: 'right',
            },
        ];
        this._tableItems = [];
        this.#isTrashedContext = new UmbIsTrashedEntityContext(this);
        this.#isTrashedContext.setIsTrashed(true);
        this.consumeContext(UMB_COLLECTION_CONTEXT, (instance) => {
            this.#collectionContext = instance;
            this.#observeCollectionItems();
        });
    }
    #observeCollectionItems() {
        if (!this.#collectionContext)
            return;
        this.observe(this.#collectionContext.items, (items) => this.#createTableItems(items), 'umbCollectionItemsObserver');
    }
    #createTableItems(items) {
        this._tableItems = items.map((item) => {
            return {
                id: item.unique,
                icon: item.mediaType.icon,
                data: [
                    {
                        columnAlias: 'name',
                        value: item,
                    },
                    {
                        columnAlias: 'entityActions',
                        value: html `<umb-entity-actions-table-column-view
							.value=${{
                            entityType: item.entityType,
                            unique: item.unique,
                            name: item.name,
                        }}></umb-entity-actions-table-column-view>`,
                    },
                ],
            };
        });
    }
    render() {
        return html `
			<umb-table .config=${this._tableConfig} .columns=${this._tableColumns} .items=${this._tableItems}></umb-table>
		`;
    }
    static { this.styles = [
        UmbTextStyles,
        css `
			:host {
				display: flex;
				flex-direction: column;
			}
		`,
    ]; }
};
__decorate([
    state()
], UmbMediaRecycleBinTreeItemTableCollectionViewElement.prototype, "_tableConfig", void 0);
__decorate([
    state()
], UmbMediaRecycleBinTreeItemTableCollectionViewElement.prototype, "_tableColumns", void 0);
__decorate([
    state()
], UmbMediaRecycleBinTreeItemTableCollectionViewElement.prototype, "_tableItems", void 0);
UmbMediaRecycleBinTreeItemTableCollectionViewElement = __decorate([
    customElement('umb-media-recycle-bin-tree-item-table-collection-view')
], UmbMediaRecycleBinTreeItemTableCollectionViewElement);
export { UmbMediaRecycleBinTreeItemTableCollectionViewElement };
export { UmbMediaRecycleBinTreeItemTableCollectionViewElement as element };
