import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class AuditLogAuthModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('AuditLogAuth', 'auditLogAuths', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'AuditLogAuthFilter', 'AuditLogAuthOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AuditLogAuth',
            fieldName: 'auditLogAuths',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('AuditLogAuth', 'auditLogAuths', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'AuditLogAuthFilter', 'AuditLogAuthOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AuditLogAuth',
            fieldName: 'auditLogAuth',
            document,
            variables,
            transform: (data) => ({
                auditLogAuth: data.auditLogAuths?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('AuditLogAuth', 'auditLogAuths', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'AuditLogAuthFilter', 'AuditLogAuthOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AuditLogAuth',
            fieldName: 'auditLogAuth',
            document,
            variables,
            transform: (data) => ({
                auditLogAuth: data.auditLogAuths?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('AuditLogAuth', 'createAuditLogAuth', 'auditLogAuth', args.select, args.data, 'CreateAuditLogAuthInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AuditLogAuth',
            fieldName: 'createAuditLogAuth',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('AuditLogAuth', 'updateAuditLogAuth', 'auditLogAuth', args.select, args.where.id, args.data, 'UpdateAuditLogAuthInput', 'id', 'auditLogAuthPatch', connectionFieldsMap, {
            createdAt: args.where.createdAt,
        });
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AuditLogAuth',
            fieldName: 'updateAuditLogAuth',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('AuditLogAuth', 'deleteAuditLogAuth', 'auditLogAuth', {
            id: args.where.id,
            createdAt: args.where.createdAt,
        }, 'DeleteAuditLogAuthInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AuditLogAuth',
            fieldName: 'deleteAuditLogAuth',
            document,
            variables,
        });
    }
}
