import { useMemo } from 'react';
import { FormStrategy, FormModel } from './models';
export function useForm(arg) {
    return useMemo(function () {
        var strategy;
        var model;
        if (arg === FormStrategy.View) {
            strategy = arg;
            model = new FormModel({});
        }
        else {
            strategy = FormStrategy.Model;
            model = arg.build();
        }
        var ctx = {
            strategy: strategy,
            form: model,
            parent: model,
        };
        return {
            ctx: ctx,
            model: model,
        };
    }, [arg]);
}
