import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class DefaultPrivilegeModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('DefaultPrivilege', 'defaultPrivileges', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'DefaultPrivilegeFilter', 'DefaultPrivilegeOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'DefaultPrivilege',
            fieldName: 'defaultPrivileges',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('DefaultPrivilege', 'defaultPrivileges', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'DefaultPrivilegeFilter', 'DefaultPrivilegeOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'DefaultPrivilege',
            fieldName: 'defaultPrivilege',
            document,
            variables,
            transform: (data) => ({
                defaultPrivilege: data.defaultPrivileges?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('DefaultPrivilege', 'defaultPrivileges', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'DefaultPrivilegeFilter', 'DefaultPrivilegeOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'DefaultPrivilege',
            fieldName: 'defaultPrivilege',
            document,
            variables,
            transform: (data) => ({
                defaultPrivilege: data.defaultPrivileges?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('DefaultPrivilege', 'createDefaultPrivilege', 'defaultPrivilege', args.select, args.data, 'CreateDefaultPrivilegeInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'DefaultPrivilege',
            fieldName: 'createDefaultPrivilege',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('DefaultPrivilege', 'updateDefaultPrivilege', 'defaultPrivilege', args.select, args.where.id, args.data, 'UpdateDefaultPrivilegeInput', 'id', 'defaultPrivilegePatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'DefaultPrivilege',
            fieldName: 'updateDefaultPrivilege',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('DefaultPrivilege', 'deleteDefaultPrivilege', 'defaultPrivilege', {
            id: args.where.id,
        }, 'DeleteDefaultPrivilegeInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'DefaultPrivilege',
            fieldName: 'deleteDefaultPrivilege',
            document,
            variables,
        });
    }
}
