"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SchemaGrantModel = void 0;
const query_builder_1 = require("../query-builder");
const input_types_1 = require("../input-types");
class SchemaGrantModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('SchemaGrant', 'schemaGrants', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'SchemaGrantFilter', 'SchemaGrantOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'SchemaGrant',
            fieldName: 'schemaGrants',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = (0, query_builder_1.buildFindFirstDocument)('SchemaGrant', 'schemaGrants', args.select, {
            where: args?.where,
        }, 'SchemaGrantFilter', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'SchemaGrant',
            fieldName: 'schemaGrants',
            document,
            variables,
        });
    }
    findOne(args) {
        const { document, variables } = (0, query_builder_1.buildFindManyDocument)('SchemaGrant', 'schemaGrants', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'SchemaGrantFilter', 'SchemaGrantOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'SchemaGrant',
            fieldName: 'schemaGrant',
            document,
            variables,
            transform: (data) => ({
                schemaGrant: data.schemaGrants?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = (0, query_builder_1.buildCreateDocument)('SchemaGrant', 'createSchemaGrant', 'schemaGrant', args.select, args.data, 'CreateSchemaGrantInput', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'SchemaGrant',
            fieldName: 'createSchemaGrant',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = (0, query_builder_1.buildUpdateByPkDocument)('SchemaGrant', 'updateSchemaGrant', 'schemaGrant', args.select, args.where.id, args.data, 'UpdateSchemaGrantInput', 'id', 'schemaGrantPatch', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'SchemaGrant',
            fieldName: 'updateSchemaGrant',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = (0, query_builder_1.buildDeleteByPkDocument)('SchemaGrant', 'deleteSchemaGrant', 'schemaGrant', {
            id: args.where.id,
        }, 'DeleteSchemaGrantInput', args.select, input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'SchemaGrant',
            fieldName: 'deleteSchemaGrant',
            document,
            variables,
        });
    }
}
exports.SchemaGrantModel = SchemaGrantModel;
