import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class OrgAdminGrantModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('OrgAdminGrant', 'orgAdminGrants', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'OrgAdminGrantFilter', 'OrgAdminGrantOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgAdminGrant',
            fieldName: 'orgAdminGrants',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('OrgAdminGrant', 'orgAdminGrants', args.select, {
            where: args?.where,
        }, 'OrgAdminGrantFilter', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgAdminGrant',
            fieldName: 'orgAdminGrants',
            document,
            variables,
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('OrgAdminGrant', 'orgAdminGrants', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'OrgAdminGrantFilter', 'OrgAdminGrantOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgAdminGrant',
            fieldName: 'orgAdminGrant',
            document,
            variables,
            transform: (data) => ({
                orgAdminGrant: data.orgAdminGrants?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('OrgAdminGrant', 'createOrgAdminGrant', 'orgAdminGrant', args.select, args.data, 'CreateOrgAdminGrantInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgAdminGrant',
            fieldName: 'createOrgAdminGrant',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('OrgAdminGrant', 'updateOrgAdminGrant', 'orgAdminGrant', args.select, args.where.id, args.data, 'UpdateOrgAdminGrantInput', 'id', 'orgAdminGrantPatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgAdminGrant',
            fieldName: 'updateOrgAdminGrant',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('OrgAdminGrant', 'deleteOrgAdminGrant', 'orgAdminGrant', {
            id: args.where.id,
        }, 'DeleteOrgAdminGrantInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgAdminGrant',
            fieldName: 'deleteOrgAdminGrant',
            document,
            variables,
        });
    }
}
