defmodule CentralcloudOps.Endpoint do
  use Phoenix.Endpoint, otp_app: :centralcloud_ops, adapter: Bandit.PhoenixAdapter

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

  plug Plug.Static,
    at: "/",
    from: {:centralcloud_ops, "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_ops_session",
    signing_salt: "ops_salt_2026",
    same_site: "Lax"

  plug CentralcloudOps.Router
end
