import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class ApiSettingModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('ApiSetting', 'apiSettings', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'ApiSettingFilter', 'ApiSettingOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'ApiSetting',
            fieldName: 'apiSettings',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('ApiSetting', 'apiSettings', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'ApiSettingFilter', 'ApiSettingOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'ApiSetting',
            fieldName: 'apiSetting',
            document,
            variables,
            transform: (data) => ({
                apiSetting: data.apiSettings?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('ApiSetting', 'apiSettings', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'ApiSettingFilter', 'ApiSettingOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'ApiSetting',
            fieldName: 'apiSetting',
            document,
            variables,
            transform: (data) => ({
                apiSetting: data.apiSettings?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('ApiSetting', 'createApiSetting', 'apiSetting', args.select, args.data, 'CreateApiSettingInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'ApiSetting',
            fieldName: 'createApiSetting',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('ApiSetting', 'updateApiSetting', 'apiSetting', args.select, args.where.id, args.data, 'UpdateApiSettingInput', 'id', 'apiSettingPatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'ApiSetting',
            fieldName: 'updateApiSetting',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('ApiSetting', 'deleteApiSetting', 'apiSetting', {
            id: args.where.id,
        }, 'DeleteApiSettingInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'ApiSetting',
            fieldName: 'deleteApiSetting',
            document,
            variables,
        });
    }
}
