defmodule CentralcloudStaff.Endpoint do
  use Phoenix.Endpoint, otp_app: :centralcloud_staff, adapter: Bandit.PhoenixAdapter

  socket "/live", Phoenix.LiveView.Socket,
    websocket: [connect_info: [session: {CentralcloudStaff.Router, :session_opts, []}]]

  plug Plug.Static,
    at: "/",
    from: {:centralcloud_staff, "priv/static"},
    gzip: false

  plug Plug.RequestId
  plug Plug.Telemetry, event_prefix: [:phoenix, :endpoint]

  plug Plug.Parsers,
    parsers: [:urlencoded, :multipart, :json],
    pass: ["*/*"],
    json_decoder: Phoenix.json_library()

  plug Plug.MethodOverride
  plug Plug.Head
  plug Plug.Session,
    store: :cookie,
    key: "_centralcloud_staff_session",
    signing_salt: "ops_salt_2026",
    same_site: "Lax"

  plug CentralcloudStaff.Router
end
