/*-
 * ~~~~~~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 javax.management.MBeanOperationInfo;

import ru.entaxy.esb.platform.base.management.core.api.Attribute;
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
import ru.entaxy.esb.platform.base.management.core.api.Operation;
import ru.entaxy.esb.platform.base.management.core.api.RuntimeTypedMBean;
import ru.entaxy.esb.platform.base.management.core.utils.BundleAwareMBean;
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;

@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATED_ONLY)
public interface EntaxyRuntimeObjectMBean extends EntaxyRuntimeItemMBean, BundleAwareMBean, RuntimeTypedMBean {

    public static final String DEFAULT_OBJECT_SUBQUALIFIER = "object";

    EntaxyRuntimeObject getRuntimeObject();

    @Override
    default String getJMXSubQualifierName() {
        if (this.getClass().isAnnotationPresent(ObjectMBean.class))
            return this.getClass().getAnnotation(ObjectMBean.class).subQualifierName();
        return DEFAULT_OBJECT_SUBQUALIFIER;
    }

    @Attribute(desc = "Managed bean Id")
    String getId();

    @Deprecated(since = "1.10.0", forRemoval = true)
    @Attribute(desc = "Object Name")
    String getName();

    @Attribute(desc = "Object Id")
    String getObjectId();

    @Attribute(desc = "Object Type")
    String getObjectType();

    @Attribute(desc = "Object full Id")
    String getObjectFullId();

    @Attribute(desc = "Object label")
    public String getObjectLabel();

    @Attribute(desc = "Display name")
    public String getDisplayName();

    @Attribute(desc = "Object factory Id")
    String getFactoryId();

    @Attribute(desc = "Object scope")
    String getScope();

    @Attribute(desc = "Object owner for private objects")
    String getOwner();

    @Attribute(desc = "Object container Id")
    String getContainerId();

    @Attribute(desc = "Object is provided via capability descriptor")
    boolean isProvided();

    @Attribute(desc = "Object is ghost: assumed by relations but not present")
    boolean isGhost();

    @Operation(desc = "Gets JSON configuration of the object", impact = MBeanOperationInfo.INFO)
    String readConfiguration();

    @Operation(desc = "Reads extended data of the object", impact = MBeanOperationInfo.INFO)
    Map<String, Map<String, Object>> readExtendedData();
}
