export function defineSchema(definition) {
    const properties = {};
    const required = [];
    for (const [key, prop] of Object.entries(definition)) {
        const jsonSchemaProperty = {};
        for (const [propertyKey, propertyValue] of Object.entries(prop)) {
            if (propertyKey !== "optional") {
                jsonSchemaProperty[propertyKey] = propertyValue;
            }
        }
        Object.defineProperty(properties, key, {
            enumerable: true,
            configurable: true,
            writable: true,
            value: jsonSchemaProperty,
        });
        if (!prop.optional) {
            required.push(key);
        }
    }
    return {
        type: "object",
        properties,
        required,
    };
}
