"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AuditLogAuthModel = void 0;
const query_builder_1 = require("../query-builder");
const input_types_1 = require("../input-types");
class AuditLogAuthModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = (0, query_builder_1.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', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'AuditLogAuth',
            fieldName: 'auditLogAuths',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = (0, query_builder_1.buildFindFirstDocument)('AuditLogAuth', 'auditLogAuths', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'AuditLogAuthFilter', 'AuditLogAuthOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.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 } = (0, query_builder_1.buildFindManyDocument)('AuditLogAuth', 'auditLogAuths', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'AuditLogAuthFilter', 'AuditLogAuthOrderBy', input_types_1.connectionFieldsMap);
        return new query_builder_1.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 } = (0, query_builder_1.buildCreateDocument)('AuditLogAuth', 'createAuditLogAuth', 'auditLogAuth', args.select, args.data, 'CreateAuditLogAuthInput', input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AuditLogAuth',
            fieldName: 'createAuditLogAuth',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = (0, query_builder_1.buildUpdateByPkDocument)('AuditLogAuth', 'updateAuditLogAuth', 'auditLogAuth', args.select, args.where.id, args.data, 'UpdateAuditLogAuthInput', 'id', 'auditLogAuthPatch', input_types_1.connectionFieldsMap, {
            createdAt: args.where.createdAt,
        });
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AuditLogAuth',
            fieldName: 'updateAuditLogAuth',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = (0, query_builder_1.buildDeleteByPkDocument)('AuditLogAuth', 'deleteAuditLogAuth', 'auditLogAuth', {
            id: args.where.id,
            createdAt: args.where.createdAt,
        }, 'DeleteAuditLogAuthInput', args.select, input_types_1.connectionFieldsMap);
        return new query_builder_1.QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'AuditLogAuth',
            fieldName: 'deleteAuditLogAuth',
            document,
            variables,
        });
    }
}
exports.AuditLogAuthModel = AuditLogAuthModel;
