/*-
 * ~~~~~~licensing~~~~~~
 * profile-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.profile;

import java.util.Collections;
import java.util.List;
import java.util.Map;

import javax.management.MBeanOperationInfo;

import ru.entaxy.esb.platform.base.management.core.Qualifier;
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.Parameter;
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBean;

@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATED_ONLY)
public interface ProfileMBean extends EntaxyRuntimeObjectMBean {

    public static interface Helper {

        public static Qualifier getQualifier(String name) {
            return ProfilesMBean.Q_PROFILES.qualifier(PROFILE_KEY, name);
        }

    }

    public static final String CAPABILITY_NAMESPACE = "entaxy.runtime.profile";

    public static final String PROFILE_KEY = "profile";

    @Attribute
    default public String getName() {
        return getObjectId();
    };

    @Attribute
    public String getDescription();

    @Deprecated(since = "1.10", forRemoval = true)
    @Attribute
    default public String getBasicAuthAccount() {
        return "";
    };

    @Deprecated(since = "1.10", forRemoval = true)
    @Attribute
    default public String getUuid() {
        return getObjectId();
    };

    @Deprecated(since = "1.10", forRemoval = true)
    @Attribute(desc = "Systems the current can send messages to")
    default public List<String> getAllowedTargets() {
        return Collections.emptyList();
    };

    @Deprecated(since = "1.10", forRemoval = true)
    @Attribute(desc = "Systems the current can receive messages from")
    default public List<String> getAllowedSources() {
        return Collections.emptyList();
    };

    @Deprecated(since = "1.10", forRemoval = true)
    @Operation(desc = "Adds connector to profile")
    public void addConnector(
            @Parameter(name = "factoryId", desc = "Connector factory ID") String connectorFactoryId,
            @Parameter(name = "parameters", desc = "Connector parameters") Map<String, String> parameters)
            throws Exception;

    @Deprecated(since = "1.10", forRemoval = true)
    @Operation(desc = "Removes connector from profile")
    public void removeConnector(
            @Parameter(name = "connectorName", desc = "Connector name") String connectorName) throws Exception;

    @Deprecated(since = "1.10", forRemoval = true)
    @Operation(desc = "Starts connector in profile")
    public void startConnector(
            @Parameter(name = "connectorName", desc = "Connector name") String connectorName) throws Exception;

    @Deprecated(since = "1.10", forRemoval = true)
    @Operation(desc = "Stops connector in profile")
    public void stopConnector(
            @Parameter(name = "connectorName", desc = "Connector name") String connectorName) throws Exception;

    @Deprecated(since = "1.10", forRemoval = true)
    @Operation(desc = "Gets connector's configuration")
    public String getConnectorConfig(
            @Parameter(name = "connectorName", desc = "Connector name") String connectorName) throws Exception;

    @Deprecated(since = "1.10", forRemoval = true)
    @Operation(desc = "Creates account for this system", impact = MBeanOperationInfo.ACTION)
    default public void createAccount(
            @Parameter(name = "login", desc = "Login") String login,
            @Parameter(name = "password", desc = "Password") String password) throws Exception {};

    @Deprecated(since = "1.10", forRemoval = true)
    @Operation(desc = "Allow this system to send messages to other system")
    default public void allowTarget(
            @Parameter(name = "targetIdOrName", desc = "Target system Id or Name") String idOrName) throws Exception {

    };

    @Deprecated(since = "1.10", forRemoval = true)
    @Operation(desc = "Allow this system to receive messages from other system")
    default public void allowSource(
            @Parameter(name = "sourceIdOrName", desc = "Source system Id or Name") String idOrName) throws Exception {

    };
}
