// CodeB softphone -- React wrapper (iframe embed)
// Docs: https://www.aloaha.com/softphone-embed-cookbook.html
// European Digital Identity Wallet: the embedded sip-js.html handles OIDC
// autofill internally -- pass tenant origin as a prop.

import React from "react";

export default function CodeBSoftphone({
  tenantOrigin = "https://phone.your-tenant.example",
  engine = "sipjs", // "sipjs" | "jssip" | "native"
  height = 1100,
  width = 820
}) {
  const page = engine === "jssip" ? "jssip.html"
             : engine === "native" ? "office.html"
             : "sip-js.html";
  const src = `${tenantOrigin}/${page}`;

  return (
    <iframe
      src={src}
      title="CodeB browser softphone"
      allow="microphone; autoplay; clipboard-write"
      width={width}
      height={height}
      style={{ border: 0, maxWidth: "100%" }}
    />
  );
}

// Usage:
// <CodeBSoftphone tenantOrigin="https://phone.acme.example" engine="sipjs" />
