import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class OrgPermissionDefaultPermissionModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('OrgPermissionDefaultPermission', 'orgPermissionDefaultPermissions', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'OrgPermissionDefaultPermissionFilter', 'OrgPermissionDefaultPermissionOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgPermissionDefaultPermission',
            fieldName: 'orgPermissionDefaultPermissions',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('OrgPermissionDefaultPermission', 'orgPermissionDefaultPermissions', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'OrgPermissionDefaultPermissionFilter', 'OrgPermissionDefaultPermissionOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgPermissionDefaultPermission',
            fieldName: 'orgPermissionDefaultPermission',
            document,
            variables,
            transform: (data) => ({
                orgPermissionDefaultPermission: data.orgPermissionDefaultPermissions?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('OrgPermissionDefaultPermission', 'orgPermissionDefaultPermissions', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'OrgPermissionDefaultPermissionFilter', 'OrgPermissionDefaultPermissionOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgPermissionDefaultPermission',
            fieldName: 'orgPermissionDefaultPermission',
            document,
            variables,
            transform: (data) => ({
                orgPermissionDefaultPermission: data.orgPermissionDefaultPermissions?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('OrgPermissionDefaultPermission', 'createOrgPermissionDefaultPermission', 'orgPermissionDefaultPermission', args.select, args.data, 'CreateOrgPermissionDefaultPermissionInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgPermissionDefaultPermission',
            fieldName: 'createOrgPermissionDefaultPermission',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('OrgPermissionDefaultPermission', 'updateOrgPermissionDefaultPermission', 'orgPermissionDefaultPermission', args.select, args.where.id, args.data, 'UpdateOrgPermissionDefaultPermissionInput', 'id', 'orgPermissionDefaultPermissionPatch', connectionFieldsMap, undefined);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgPermissionDefaultPermission',
            fieldName: 'updateOrgPermissionDefaultPermission',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('OrgPermissionDefaultPermission', 'deleteOrgPermissionDefaultPermission', 'orgPermissionDefaultPermission', {
            id: args.where.id,
        }, 'DeleteOrgPermissionDefaultPermissionInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgPermissionDefaultPermission',
            fieldName: 'deleteOrgPermissionDefaultPermission',
            document,
            variables,
        });
    }
}
