import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class FullTextSearchModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('FullTextSearch', 'fullTextSearches', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'FullTextSearchFilter', 'FullTextSearchOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FullTextSearch',
            fieldName: 'fullTextSearches',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('FullTextSearch', 'fullTextSearches', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'FullTextSearchFilter', 'FullTextSearchOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FullTextSearch',
            fieldName: 'fullTextSearch',
            document,
            variables,
            transform: (data) => ({
                fullTextSearch: data.fullTextSearches?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('FullTextSearch', 'fullTextSearches', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'FullTextSearchFilter', 'FullTextSearchOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'FullTextSearch',
            fieldName: 'fullTextSearch',
            document,
            variables,
            transform: (data) => ({
                fullTextSearch: data.fullTextSearches?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('FullTextSearch', 'createFullTextSearch', 'fullTextSearch', args.select, args.data, 'CreateFullTextSearchInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FullTextSearch',
            fieldName: 'createFullTextSearch',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('FullTextSearch', 'updateFullTextSearch', 'fullTextSearch', args.select, args.where.id, args.data, 'UpdateFullTextSearchInput', 'id', 'fullTextSearchPatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FullTextSearch',
            fieldName: 'updateFullTextSearch',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('FullTextSearch', 'deleteFullTextSearch', 'fullTextSearch', {
            id: args.where.id,
        }, 'DeleteFullTextSearchInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'FullTextSearch',
            fieldName: 'deleteFullTextSearch',
            document,
            variables,
        });
    }
}
