/*-
 * ~~~~~~licensing~~~~~~
 * object-management
 * ==========
 * Copyright (C) 2020 - 2025 EmDev LLC
 * ==========
 * You may not use this file except in accordance with the License Terms of the Copyright
 * Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
 * rights to the Software and any copies are the property of the Copyright Holder. Unless
 * it is explicitly allowed the Copyright Holder, the User is prohibited from using the
 * Software for commercial purposes to provide services to third parties.
 * 
 * The Copyright Holder hereby declares that the Software is provided on an "AS IS".
 * Under no circumstances does the Copyright Holder guarantee or promise that the
 * Software provided by him will be suitable or not suitable for the specific purposes
 * of the User, that the Software will meet all commercial and personal subjective
 * expectations of the User, that the Software will work properly, without technical
 * errors, quickly and uninterruptedly.
 * 
 * Under no circumstances shall the Copyright Holder or its Affiliates is not liable
 * to the User for any direct or indirect losses of the User, his expenses or actual
 * damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
 * or damage to data, property, etc.
 * ~~~~~~/licensing~~~~~~
 */
package ru.entaxy.platform.core.management.object;

import java.util.Map;

import ru.entaxy.esb.platform.base.management.core.ManagementCore;
import ru.entaxy.esb.platform.base.management.core.Qualifier;
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;

@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATED_ONLY)
public interface EntaxyRuntimeItemMBean {

    String JMX_SUBPATH_QUALIFIER = "subgroup";

    String JMX_SUBQUALIFIER_AUTO = "@AUTO@";

    EntaxyRuntimeItemMBean DEFAULT_PARENT_MBEAN = new EntaxyRuntimeItemMBean() {

        @Override
        public Class<? extends EntaxyRuntimeItemMBean> getMBeanClass() {
            // TODO Auto-generated method stub
            return null;
        }

        public String getJMXSubQualifier() {
            return ManagementCore.Q_RUNTIME_S;
        };

        @Override
        public String getJMXSubQualifierValue() {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public String getJMXSubQualifierName() {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public Qualifier getJMXQualifier() {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public String getId() {
            // TODO Auto-generated method stub
            return null;
        }

        public EntaxyRuntimeItemMBean getParentMBean() {
            return null;
        }

        @Override
        public void setParentMBean(EntaxyRuntimeItemMBean mBean) {
            // TODO Auto-generated method stub

        }

        @Override
        public void setParentSubPath(String subPath) {
            // TODO Auto-generated method stub

        }

        @Override
        public void setJMXSubQualifierName(String name) {
            // TODO Auto-generated method stub

        }

        @Override
        public void setJMXSubQualifierValue(String value) {
            // TODO Auto-generated method stub

        }

        @Override
        public Map<String, EntaxyRuntimeItemMBean> getChildMBeans() {
            // TODO Auto-generated method stub
            return null;
        }

        @Override
        public void addChildMBean(EntaxyRuntimeItemMBean mBean) {
            // TODO Auto-generated method stub

        }

        @Override
        public void removeChildMBean(EntaxyRuntimeItemMBean mBean) {
            // TODO Auto-generated method stub

        }

    };


    Qualifier getJMXQualifier();

    default String getJMXSubQualifier() {
        return getJMXSubQualifierName().concat("=").concat(getJMXSubQualifierValue());
    };

    default EntaxyRuntimeItemMBean getParentMBean() {
        return DEFAULT_PARENT_MBEAN;
    };

    void setParentMBean(EntaxyRuntimeItemMBean mBean);

    default String getParentSubPath() {
        return "";
    };

    void setParentSubPath(String subPath);

    Map<String, EntaxyRuntimeItemMBean> getChildMBeans();

    void addChildMBean(EntaxyRuntimeItemMBean mBean);

    void removeChildMBean(EntaxyRuntimeItemMBean mBean);

    String getJMXSubQualifierName();

    void setJMXSubQualifierName(String name);

    String getJMXSubQualifierValue();

    void setJMXSubQualifierValue(String value);

    String getId();

    Class<? extends EntaxyRuntimeItemMBean> getMBeanClass();
}
