import { UMB_MEMBER_TYPE_DETAIL_REPOSITORY_ALIAS, UMB_MEMBER_TYPE_ENTITY_TYPE } from '../index.js';
import { UmbMemberTypeWorkspaceEditorElement } from './member-type-workspace-editor.element.js';
import { UMB_MEMBER_TYPE_WORKSPACE_ALIAS } from './constants.js';
import { UmbWorkspaceIsNewRedirectController, } from '../../../core/workspace/index.js';
import { UmbContentTypeWorkspaceContextBase, } from '../../../content/content-type/index.js';
export class UmbMemberTypeWorkspaceContext extends UmbContentTypeWorkspaceContextBase {
    constructor(host) {
        super(host, {
            workspaceAlias: UMB_MEMBER_TYPE_WORKSPACE_ALIAS,
            entityType: UMB_MEMBER_TYPE_ENTITY_TYPE,
            detailRepositoryAlias: UMB_MEMBER_TYPE_DETAIL_REPOSITORY_ALIAS,
        });
        this.routes.setRoutes([
            {
                path: 'create/parent/:parentEntityType/:parentUnique',
                component: UmbMemberTypeWorkspaceEditorElement,
                setup: async (_component, info) => {
                    const parentEntityType = info.match.params.parentEntityType;
                    const parentUnique = info.match.params.parentUnique === 'null' ? null : info.match.params.parentUnique;
                    const parent = { entityType: parentEntityType, unique: parentUnique };
                    await this.createScaffold({ parent });
                    new UmbWorkspaceIsNewRedirectController(this, this, this.getHostElement().shadowRoot.querySelector('umb-router-slot'));
                },
            },
            {
                path: 'edit/:unique',
                component: UmbMemberTypeWorkspaceEditorElement,
                setup: (_component, info) => {
                    const unique = info.match.params.unique;
                    this.load(unique);
                },
            },
        ]);
    }
}
export { UmbMemberTypeWorkspaceContext as api };
