defmodule Glific.Providers.MessageBehaviour do
  @moduledoc """
  The message behaviour which all the providers needs to implement for communication
  """

  @callback send_text(
              message :: Glific.Messages.Message.t(),
              attrs :: map()
            ) ::
              {:ok, Oban.Job.t()} | {:error, Ecto.Changeset.t()} | {:error, String.t()}

  @callback send_image(message :: Glific.Messages.Message.t(), attrs :: map()) ::
              {:ok, Oban.Job.t()} | {:error, Ecto.Changeset.t()} | {:error, String.t()}

  @callback send_audio(message :: Glific.Messages.Message.t(), attrs :: map()) ::
              {:ok, Oban.Job.t()} | {:error, Ecto.Changeset.t()}

  @callback send_video(message :: Glific.Messages.Message.t(), attrs :: map()) ::
              {:ok, Oban.Job.t()} | {:error, Ecto.Changeset.t()} | {:error, String.t()}

  @callback send_document(message :: Glific.Messages.Message.t(), attrs :: map()) ::
              {:ok, Oban.Job.t()} | {:error, Ecto.Changeset.t()}

  @callback send_sticker(message :: Glific.Messages.Message.t(), attrs :: map()) ::
              {:ok, Oban.Job.t()} | {:error, Ecto.Changeset.t()}

  @callback send_interactive(message :: Glific.Messages.Message.t(), attrs :: map()) ::
              {:ok, Oban.Job.t()} | {:error, Ecto.Changeset.t()}

  @callback receive_text(payload :: map()) :: map()

  @callback receive_media(payload :: map()) :: map()

  @callback receive_location(payload :: map()) :: map()

  @callback receive_interactive(payload :: map()) :: map()

  @callback receive_billing_event(payload :: map()) :: {:ok, map()} | {:error, String.t()}
end
