'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

const index = require('./index-7cdf1df1.js');
require('./index-c2a077ae.js');
require('./InterceptorHandler-09a1e84b.js');
require('./data-model-f9df493f.js');
require('./app-config-9060e777.js');
require('./BaseField-f50bb8f0.js');
require('./FieldModelGenerator-5a321a60.js');
require('./date-8e8ca89a.js');
require('./index-e79eb186.js');
require('./table-config-b20b4da1.js');
require('./string-9e6ebf63.js');
require('./membership-config-47f4733e.js');
require('./data-transfer-field-025bce2f.js');
require('./filter-52876f3c.js');
require('./index-17c935e7.js');
require('./form-view-config-cc5244bd.js');
require('./view-config-f8b4b929.js');
require('./actions-d7eabd95.js');
require('./services-895a8d1d.js');
require('./attachment-c2bc9126.js');
require('./spaces-5c8e9d99.js');
require('./index-35a4d634.js');
require('./table-list-view-config-1c3d8326.js');
require('./nested-14baa4ef.js');
const tableListViewDomain = require('./table-list-view-domain-32cf51ac.js');

const DevingenProductRootDamga = class {
  constructor(hostRef) {
    index.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 === tableListViewDomain.ID$1) {
          // show create new domain form
          this.isCreateDomainFormShown = true;
        }
        else if (navigateForwardAction.viewId === tableListViewDomain.ID$2) {
          // show create new domain form
          this.isUpdateDomainFormShown = true;
          this.updateDomainFormParams = navigateForwardAction.params;
        }
        else if (navigateForwardAction.viewId === tableListViewDomain.ID$3) {
          // show move domain form
          this.isMoveDomainFormShown = true;
          this.moveDomainFormParams = navigateForwardAction.params;
        }
        else if (navigateForwardAction.viewId === tableListViewDomain.ID$4) {
          // 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 (index.h(index.Host, { class: "container d-block" }, index.h("div", { class: "row justify-content-md-center" }, index.h("div", { class: "col-sm-12" }, index.h("dvn-app-view-list-view-table", { id: tableListViewDomain.ID, apiData: apiData, view: tableListViewDomain.viewConfig(product._id) }), isCreateDomainFormShown &&
      index.h("dvn-dialog", { raw: true, shown: true, onDismiss: () => this.isCreateDomainFormShown = false }, index.h("dvn-app-view-form-view", { params: {
          productId: product._id,
        }, view: tableListViewDomain.config(apiDamga) })), isUpdateDomainFormShown &&
      index.h("dvn-dialog", { raw: true, shown: true, onDismiss: () => this.isUpdateDomainFormShown = false }, index.h("dvn-app-view-form-view", { params: updateDomainFormParams, view: tableListViewDomain.config$1(apiDamga) })), isMoveDomainFormShown &&
      index.h("dvn-dialog", { raw: true, shown: true, onDismiss: () => this.isMoveDomainFormShown = false }, index.h("dvn-app-view-form-view", { params: moveDomainFormParams, view: tableListViewDomain.config$2(apiDamga, products, workspaceOwnerships) })), isDeleteDomainFormShown &&
      index.h("dvn-dialog", { raw: true, shown: true, onDismiss: () => this.isDeleteDomainFormShown = false }, index.h("dvn-app-view-form-view", { params: deleteDomainFormParams, view: tableListViewDomain.config$3(apiDamga) }))))));
  }
  get el() { return index.getElement(this); }
};

exports.devingen_product_damga_domains = DevingenProductRootDamga;
