import Button from "@/components/TempDesignSystem/Button"

import styles from "./footer.module.css"

import type { ButtonHTMLAttributes, PropsWithChildren } from "react"
import type { ButtonProps as ReactAriaButtonProps } from "react-aria-components"

import type { ButtonProps as _ButtonProps } from "@/components/TempDesignSystem/Button/button"

export default function Footer({ children }: PropsWithChildren) {
  return <footer className={styles.footer}>{children}</footer>
}

interface ButtonProps extends PropsWithChildren {
  intent?: _ButtonProps["intent"]
  onClick?: ReactAriaButtonProps["onPress"]
  type?: ButtonHTMLAttributes<HTMLButtonElement>["type"]
}

interface PrimaryButtonProps extends ButtonProps {
  disabled?: boolean
  form?: string
}

Footer.Primary = function PrimaryButton({
  children,
  disabled = false,
  form,
  intent = "primary",
  onClick,
  type = "button",
}: PrimaryButtonProps) {
  return (
    <Button
      disabled={disabled}
      form={form}
      intent={intent}
      onClick={onClick}
      theme="base"
      type={type}
    >
      {children}
    </Button>
  )
}

Footer.Secondary = function SecondaryButton({
  children,
  intent = "text",
  onClick,
  type = "button",
}: ButtonProps) {
  return (
    <Button
      color="burgundy"
      intent={intent}
      onClick={onClick}
      theme="base"
      type={type}
    >
      {children}
    </Button>
  )
}
