import { Alert, Button } from "@wrnexus/ui"

component ImpersonationBanner {
  props {
    visible: boolean = true
    targetName: string = "this user"
    stopAction: string = "/api/auth/impersonation/stop"
    stopSchema: string = "auth-empty"
    redirect: string = "/account"
    message: string = "You are viewing the application as"
    stopLabel: string = "Stop impersonating"
    color: string = "warning"
    size: string = "md"
    class: string = ""
  }

  view {
    {#if visible}
      <Alert {...attrs} title='{message + " " + targetName}' icon="icon-[lucide--scan-face]" color='{color}' size='{size}' variant="soft" class='{class}'>
        <form method="post" action='{stopAction}' data-schema='{stopSchema}' data-redirect='{redirect}' novalidate class="mt-2">
          <p data-error="_form" role="alert" class="m-0 hidden text-xs text-[var(--wire-color-danger)]"></p>
          <Button type="submit" label='{stopLabel}' color='{color}' size="sm" />
        </form>
      </Alert>
    {/if}
  }
}
