import { Entity } from "../../protocol/entity/Entity";
import { IProtocol } from "../../protocol/invoke/IProtocol";
import { ExternalSystemArray } from "./ExternalSystemArray";
import { ExternalSystem } from "./ExternalSystem";
import { Invoke } from "../../protocol/invoke/Invoke";
/**
* A role of an external system.
*
* The {@link ExternalSystemRole} class represents a role, *WHAT TO DO*. Extends the {@link ExternalSystemRole} class
* and overrides {@link replyData replyData()} to define the *WHAT TO DO*. And assign this {@link ExternalSystemRole}
* object to related {@link ExternalSystem} object.
*
*
*
*
*
* #### Proxy Pattern
* The {@link ExternalSystemRole} class can be an *logical proxy*. In framework within user, which
* {@link ExternalSystem external system} is connected with {@link ExternalSystemArray this system}, it's not
* important. Only interested in user's perspective is *which can be done*.
*
* By using the *logical proxy*, user dont't need to know which {@link ExternalSystemRole role} is belonged
* to which {@link ExternalSystem system}. Just access to a role directly from {@link ExternalSystemArray.getRole}.
* Sends and receives {@link Invoke} message via the {@link ExternalSystemRole role}.
*
*
* -
* {@link ExternalSystemRole} can be accessed from {@link ExternalSystemArray} directly, without inteferring
* from {@link ExternalSystem} object, via {@link ExternalSystemArray.getRole ExternalSystemArray.getRole()}.
*
* -
* When you want to send an {@link Invoke} message to the belonged {@link ExternalSystem system}, just call
* {@link ExternalSystemRole.sendData ExternalSystemRole.sendData()}. Then, the message will be sent to the
* external system.
*
* - Those strategy is called *Proxy Pattern*.
*
*
* @handbook [Templates - External System](https://github.com/samchon/framework/wiki/TypeScript-Templates-External_System)
* @author Jeongho Nam
*/
export declare abstract class ExternalSystemRole extends Entity implements IProtocol {
/**
* @hidden
*/
private system;
/**
* A name, represents and identifies this {@link ExternalSystemRole role}.
*
* This {@link name} is an identifier represents this {@link ExternalSystemRole role}. This {@link name} is
* used in {@link ExternalSystemArray.getRole} and {@link ExternalSystem.get}, as a key elements. Thus, this
* {@link name} should be unique in an {@link ExternalSystemArray}.
*/
protected name: string;
/**
* Constructor from a system.
*
* @param system An external system containing this role.
*/
constructor(system: ExternalSystem);
/**
* Identifier of {@link ExternalSystemRole} is its {@link name}.
*/
key(): string;
/**
* Get grandparent {@link ExternalSystemArray}.
*
* Get the grandparent {@link ExternalSystemArray} object through this parent {@link ExternalSystem},
* {@link ExternalSystem.getSystemArray ExternalSystem.getSystemArray()}.
*
* @return The grandparent {@link ExternalSystemArray} object.
*/
getSystemArray(): ExternalSystemArray;
/**
* Get parent {@link ExternalSystemRole} object.
*/
getSystem(): ExternalSystem;
/**
* Get name, who represents and identifies this role.
*/
getName(): string;
/**
* Send an {@link Invoke} message.
*
* Sends an {@link Invoke} message to remote system through the parent {@link ExternalSystem} object.
*
* @param invoke An {@link Invoke} message to send to the external system.
*/
sendData(invoke: Invoke): void;
/**
* Handle replied {@link Invoke} message.
*
* {@link ExternalSystemRole.replyData ExternalSystemRole.replyData()} is an abstract method handling a replied
* {@link Invoke message} gotten from remote system via parent {@link ExternalSystem} object. Overrides this
* method and defines the *WHAT TO DO* with the {@link Invoke message}.
*
* @param invoke An {@link Invoke} message received from the {@link ExternalSystem external system}.
*/
abstract replyData(invoke: Invoke): void;
/**
* Tag name of the {@link ExternalSytemRole} in {@link XML}.
*
* @return *role*.
*/
TAG(): string;
}