import { r as registerInstance, h, H as Host, g as getElement } from './index-55faf181.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-391279b6.js';
import './index-da37d89d.js';
import './index-403e215e.js';
import './BaseField-461b6d0c.js';
import './nested-395a4cd4.js';
import './data-transfer-field-918730a3.js';
import './app-config-d490f9ae.js';
import './data-model-f5160369.js';
import './filter-cbaa3d7d.js';
import './table-list-view-config-8e775e94.js';
import './index-ebde6a66.js';
import './attachment-32decf79.js';
import './index-6a1cf9c1.js';
import './date-ce777316.js';
import './index-083a6906.js';
import './membership-config-a51a5232.js';
import './table-config-5c917348.js';
import './FieldModelGenerator-1ee7fda2.js';
import './index-fa1db470.js';
import './string-3065a411.js';
import './spaces-460b4232.js';
import './InterceptorHandler-6474bcf4.js';
import './view-config-39fd369a.js';
import './services-fc4ce8f3.js';
import './form-view-config-00abddd1.js';
import './actions-b9a0f808.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 };
