import { computed, ref } from "vue";
import { createSchema, serializeSchema, validateSchema } from "@inkline/inkline/validation";
export function useForm(formSchema) {
  const schema = ref(createSchema(formSchema));
  const form = computed(() => serializeSchema(schema.value));
  async function validate() {
    schema.value = await validateSchema(schema.value);
  }
  return {
    form,
    schema,
    validate
  };
}
