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';
let UmbMemberGroupTableCollectionViewElement = class UmbMemberGroupTableCollectionViewElement extends UmbLitElement {
    #collectionContext;
    constructor() {
        super();
        this._tableConfig = {
            allowSelection: false,
        };
        this._tableColumns = [
            {
                name: this.localize.term('general_name'),
                alias: 'memberGroupName',
            },
            {
                name: '',
                alias: 'entityActions',
                align: 'right',
            },
        ];
        this._tableItems = [];
        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(memberGroups) {
        this._tableItems = memberGroups.map((memberGroup) => {
            return {
                id: memberGroup.unique,
                icon: 'icon-users',
                data: [
                    {
                        columnAlias: 'memberGroupName',
                        value: html `<a href=${'section/member-management/workspace/member-group/edit/' + memberGroup.unique}
							>${memberGroup.name}</a
						>`,
                    },
                    {
                        columnAlias: 'entityActions',
                        value: html `<umb-entity-actions-table-column-view
							.value=${{
                            entityType: memberGroup.entityType,
                            unique: memberGroup.unique,
                            name: memberGroup.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()
], UmbMemberGroupTableCollectionViewElement.prototype, "_tableConfig", void 0);
__decorate([
    state()
], UmbMemberGroupTableCollectionViewElement.prototype, "_tableColumns", void 0);
__decorate([
    state()
], UmbMemberGroupTableCollectionViewElement.prototype, "_tableItems", void 0);
UmbMemberGroupTableCollectionViewElement = __decorate([
    customElement('umb-member-group-table-collection-view')
], UmbMemberGroupTableCollectionViewElement);
export { UmbMemberGroupTableCollectionViewElement };
export default UmbMemberGroupTableCollectionViewElement;
