'use strict';

const { makeExtendSchemaPlugin, gql } = require('graphile-utils');

const schemaExtender = makeExtendSchemaPlugin(_build => ({
    typeDefs: gql`
        extend type Site {
            independent: Boolean @requires(columns: ["parameters"])
        }
    `,
    resolvers: {
        Site: {
            independent(parent, _args, _context, _info) {
                return !!parent.parameters?.independent;
            },
        },
    },
}));

module.exports = [schemaExtender];
