#pragma once

#include "Socket.h"
#include "SocketInterface.h"

#include <memory>
#include <map>

class ISocketMessageHandler;

class UnixSocketInterface : public ISocketInterface
{

public:

    UnixSocketInterface();

    virtual ~UnixSocketInterface();

    static std::unique_ptr<UnixSocketInterface> Create();

    void InitializeSocket(const SocketPtr& socket, const std::string& address = {}) override;

    void Listen(const SocketPtr& socket) override;

    void Write(const SocketPtr& socket, const std::string& message) override;

    void Run(const SocketPtr& socket) override;

private:

    std::size_t mBufferSize { 0 };
    std::unique_ptr<ISocketMessageHandler> mMessageHandler;
};

using UnixSocketInterfacePtr = std::unique_ptr<UnixSocketInterface>;
