import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class OrgPermissionDefaultModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('OrgPermissionDefault', 'orgPermissionDefaults', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'OrgPermissionDefaultFilter', 'OrgPermissionDefaultOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgPermissionDefault',
            fieldName: 'orgPermissionDefaults',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('OrgPermissionDefault', 'orgPermissionDefaults', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'OrgPermissionDefaultFilter', 'OrgPermissionDefaultOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgPermissionDefault',
            fieldName: 'orgPermissionDefault',
            document,
            variables,
            transform: (data) => ({
                orgPermissionDefault: data.orgPermissionDefaults?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('OrgPermissionDefault', 'orgPermissionDefaults', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'OrgPermissionDefaultFilter', 'OrgPermissionDefaultOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgPermissionDefault',
            fieldName: 'orgPermissionDefault',
            document,
            variables,
            transform: (data) => ({
                orgPermissionDefault: data.orgPermissionDefaults?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('OrgPermissionDefault', 'createOrgPermissionDefault', 'orgPermissionDefault', args.select, args.data, 'CreateOrgPermissionDefaultInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgPermissionDefault',
            fieldName: 'createOrgPermissionDefault',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('OrgPermissionDefault', 'updateOrgPermissionDefault', 'orgPermissionDefault', args.select, args.where.id, args.data, 'UpdateOrgPermissionDefaultInput', 'id', 'orgPermissionDefaultPatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgPermissionDefault',
            fieldName: 'updateOrgPermissionDefault',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('OrgPermissionDefault', 'deleteOrgPermissionDefault', 'orgPermissionDefault', {
            id: args.where.id,
        }, 'DeleteOrgPermissionDefaultInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgPermissionDefault',
            fieldName: 'deleteOrgPermissionDefault',
            document,
            variables,
        });
    }
}
