import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class IdentityProviderModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('IdentityProvider', 'identityProviders', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'IdentityProviderFilter', 'IdentityProviderOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'IdentityProvider',
            fieldName: 'identityProviders',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('IdentityProvider', 'identityProviders', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'IdentityProviderFilter', 'IdentityProviderOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'IdentityProvider',
            fieldName: 'identityProvider',
            document,
            variables,
            transform: (data) => ({
                identityProvider: data.identityProviders?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('IdentityProvider', 'createIdentityProvider', 'identityProvider', args.select, args.data, 'CreateIdentityProviderInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'IdentityProvider',
            fieldName: 'createIdentityProvider',
            document,
            variables,
        });
    }
}
