import { FC } from "react"
import { StatusBoxItemInterface } from "../../types"
import { filterNumber } from "../../utility/status"

type Props = {
    item: StatusBoxItemInterface,
    detail?: boolean
}
export const StatusBoxItem: FC<Props> = ({ item, detail = false }) => {
    return (
        <div className="w-full bg-auth-form p-[18px] h-full rounded-[40px] flex flex-col gap-[42px]">
            {detail ? <div className="flex flex-row justify-between">
                <div className="size-16 bg-secondary-color flex justify-center rounded-full items-center">
                    {item?.icon}
                </div>
                <div className="flex flex-col gap-2">
                    <p className="font-normal text-xs text-secondary-text-color">قیمت لحظه ای</p>
                    <div className="flex flex-row gap-2 items-end">
                        <p className="font-medium text-xl text-secondary-text-color">{filterNumber(55803)}</p>
                        <p className="font-normal text-xs text-secondary-text-color">تومان</p>
                    </div>
                </div>
            </div> : <div className="size-16 bg-secondary-color flex justify-center rounded-full items-center">
                {item?.icon}
            </div>}
            <div className="flex flex-col gap-3">
                <p className="font-normal text-base text-secondary-text-color">{item?.title}</p>
                <div className="font-medium text-[28px] text-primary-text-color">
                    {item?.name === "coin" && (
                        <span className="flex items-end gap-x-1">
                            {filterNumber(item?.value)} <span className="text-lg font-normal">تومان</span>
                        </span>
                    )}
                    {item?.name === "dollar" && (
                        <span className="text-lg font-normal flex items-center gap-x-1">
                            $ <span className="font-medium text-[28px] text-primary-text-color">
                                {filterNumber(item?.value)}
                            </span>
                        </span>
                    )}
                    {item?.name !== "coin" && item?.name !== "dollar" && item?.value}
                </div>
            </div>
        </div>

    )
}