/*-
 * ~~~~~~licensing~~~~~~
 * profile-commons
 * ==========
 * Copyright (C) 2020 - 2021 EmDev LLC
 * ==========
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ~~~~~~/licensing~~~~~~
 */
package ru.entaxy.esb.system.profile.commons;

import ru.entaxy.esb.system.profile.commons.profile_output.ProfileOutput;

import java.util.Objects;

public abstract class CommonProfile implements Profile {

    protected String systemName = "system";
    protected ProfileOutput profileOutput;
    protected InConnectorCollector inConnectorCollector;

    @Override
    public void send(Object request) {
        doSend(request);
    }

    protected abstract void doSend(Object request);

    @Override
    public String getSystemName() {
        return systemName;
    }

    public void setSystemName(String systemName) {
        this.systemName = systemName;
    }

    @Override
    public ProfileOutput getProfileOutput() {
        return profileOutput;
    }

    public void setProfileOutput(ProfileOutput profileOutput) {
        this.profileOutput = profileOutput;
    }

    public InConnectorCollector getInConnectorCollector() {
        return inConnectorCollector;
    }

    public void setInConnectorCollector(InConnectorCollector inConnectorCollector) {
        this.inConnectorCollector = inConnectorCollector;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        CommonProfile that = (CommonProfile) o;
        return Objects.equals(systemName, that.systemName);
    }

    @Override
    public int hashCode() {
        return Objects.hash(systemName);
    }

    @Override
    public String toString() {
        return "CommonProfile{" +
                "systemName='" + systemName + '\'' +
                '}';
    }
}
