'use strict';

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

const index = require('./index-36b3af04.js');
const tableListViewDomain = require('./table-list-view-domain-ffc6c5ab.js');
require('./index-0cd3bcc0.js');
require('./index-a8f1783c.js');
require('./BaseField-d019ade6.js');
require('./nested-8980065f.js');
require('./data-transfer-field-0ce05c1a.js');
require('./app-config-e62f5843.js');
require('./data-model-c51de090.js');
require('./filter-d5040f65.js');
require('./table-list-view-config-298c7662.js');
require('./index-d90390f1.js');
require('./attachment-3090e25e.js');
require('./index-74a00556.js');
require('./date-25b104f6.js');
require('./index-fe19a98b.js');
require('./membership-config-707b2c51.js');
require('./table-config-444a77e4.js');
require('./FieldModelGenerator-205dd99c.js');
require('./index-ae305bae.js');
require('./string-de672b69.js');
require('./spaces-2fa9fa10.js');
require('./InterceptorHandler-09a1e84b.js');
require('./view-config-ec5f62df.js');
require('./services-895a8d1d.js');
require('./form-view-config-51279874.js');
require('./actions-d7eabd95.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;
