import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class SqlActionModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('SqlAction', 'sqlActions', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'SqlActionFilter', 'SqlActionOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'SqlAction',
            fieldName: 'sqlActions',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('SqlAction', 'sqlActions', args.select, {
            where: args?.where,
        }, 'SqlActionFilter', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'SqlAction',
            fieldName: 'sqlActions',
            document,
            variables,
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('SqlAction', 'sqlActions', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'SqlActionFilter', 'SqlActionOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'SqlAction',
            fieldName: 'sqlAction',
            document,
            variables,
            transform: (data) => ({
                sqlAction: data.sqlActions?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('SqlAction', 'createSqlAction', 'sqlAction', args.select, args.data, 'CreateSqlActionInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'SqlAction',
            fieldName: 'createSqlAction',
            document,
            variables,
        });
    }
}
