import { r as registerInstance, h, H as Host, g as getElement } from './index-b6f10a81.js';
import './index-ec7dc2ad.js';
import './InterceptorHandler-6474bcf4.js';
import './data-model-bb5789f5.js';
import './app-config-cf28072f.js';
import './BaseField-d94c5b14.js';
import './FieldModelGenerator-6ec60042.js';
import './date-b270be76.js';
import './index-94c1d7bf.js';
import './table-config-c0c15e50.js';
import './string-2d991277.js';
import './membership-config-856f6e58.js';
import './data-transfer-field-1ad95e08.js';
import './filter-cbaa3d7d.js';
import './index-44e741ab.js';
import './form-view-config-bb777190.js';
import './view-config-3ab16b28.js';
import './actions-b9a0f808.js';
import './services-fc4ce8f3.js';
import './attachment-8831acff.js';
import './spaces-ba2f2c63.js';
import './index-47482faa.js';
import './table-list-view-config-80e66dd9.js';
import './nested-15d95467.js';
import { a as ID, b as ID$1, c as ID$2, e as ID$3, I as ID$4, v as viewConfig, f as config, g as config$1, h as config$2, i as config$3 } from './table-list-view-domain-d7a33a05.js';

const DevingenProductRootDamga = class {
  constructor(hostRef) {
    registerInstance(this, hostRef);
    this.isCreateDomainFormShown = false;
    this.isMoveDomainFormShown = false;
    this.isDeleteDomainFormShown = false;
    this.isUpdateDomainFormShown = false;
  }
  onAction(event) {
    const action = event.detail;
    if (action.type === 'navigation') {
      const navigateAction = action;
      if (navigateAction.direction === 'back') {
        // create/update/delete/move domain form closes itself
        this.isCreateDomainFormShown = false;
        this.isUpdateDomainFormShown = false;
        this.isMoveDomainFormShown = false;
        this.isDeleteDomainFormShown = false;
      }
      else if (navigateAction.direction === 'forward') {
        const navigateForwardAction = action;
        if (navigateForwardAction.viewId === ID) {
          // show create new domain form
          this.isCreateDomainFormShown = true;
        }
        else if (navigateForwardAction.viewId === ID$1) {
          // show create new domain form
          this.isUpdateDomainFormShown = true;
          this.updateDomainFormParams = navigateForwardAction.params;
        }
        else if (navigateForwardAction.viewId === ID$2) {
          // show move domain form
          this.isMoveDomainFormShown = true;
          this.moveDomainFormParams = navigateForwardAction.params;
        }
        else if (navigateForwardAction.viewId === ID$3) {
          // show delete domain form
          this.isDeleteDomainFormShown = true;
          this.deleteDomainFormParams = navigateForwardAction.params;
        }
      }
    }
  }
  onInvalidation(event) {
    var _a;
    (_a = this.el.querySelector(`#${event.detail.targetViewId}`)) === null || _a === void 0 ? void 0 : _a.invalidate(event);
  }
  ;
  render() {
    const { apiDamga, apiData, isCreateDomainFormShown, isDeleteDomainFormShown, isMoveDomainFormShown, isUpdateDomainFormShown, product, products, updateDomainFormParams, workspaceOwnerships, moveDomainFormParams, deleteDomainFormParams, } = this;
    return (h(Host, { class: "container d-block" }, h("div", { class: "row justify-content-md-center" }, h("div", { class: "col-sm-12" }, h("dvn-app-view-list-view-table", { id: ID$4, apiData: apiData, view: viewConfig(product._id) }), isCreateDomainFormShown &&
      h("dvn-dialog", { raw: true, shown: true, onDismiss: () => this.isCreateDomainFormShown = false }, h("dvn-app-view-form-view", { params: {
          productId: product._id,
        }, view: config(apiDamga) })), isUpdateDomainFormShown &&
      h("dvn-dialog", { raw: true, shown: true, onDismiss: () => this.isUpdateDomainFormShown = false }, h("dvn-app-view-form-view", { params: updateDomainFormParams, view: config$1(apiDamga) })), isMoveDomainFormShown &&
      h("dvn-dialog", { raw: true, shown: true, onDismiss: () => this.isMoveDomainFormShown = false }, h("dvn-app-view-form-view", { params: moveDomainFormParams, view: config$2(apiDamga, products, workspaceOwnerships) })), isDeleteDomainFormShown &&
      h("dvn-dialog", { raw: true, shown: true, onDismiss: () => this.isDeleteDomainFormShown = false }, h("dvn-app-view-form-view", { params: deleteDomainFormParams, view: config$3(apiDamga) }))))));
  }
  get el() { return getElement(this); }
};

export { DevingenProductRootDamga as devingen_product_damga_domains };
