import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class PrincipalScopeOverrideModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('PrincipalScopeOverride', 'principalScopeOverrides', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'PrincipalScopeOverrideFilter', 'PrincipalScopeOverrideOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PrincipalScopeOverride',
            fieldName: 'principalScopeOverrides',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('PrincipalScopeOverride', 'principalScopeOverrides', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'PrincipalScopeOverrideFilter', 'PrincipalScopeOverrideOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PrincipalScopeOverride',
            fieldName: 'principalScopeOverride',
            document,
            variables,
            transform: (data) => ({
                principalScopeOverride: data.principalScopeOverrides?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('PrincipalScopeOverride', 'principalScopeOverrides', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'PrincipalScopeOverrideFilter', 'PrincipalScopeOverrideOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PrincipalScopeOverride',
            fieldName: 'principalScopeOverride',
            document,
            variables,
            transform: (data) => ({
                principalScopeOverride: data.principalScopeOverrides?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('PrincipalScopeOverride', 'createPrincipalScopeOverride', 'principalScopeOverride', args.select, args.data, 'CreatePrincipalScopeOverrideInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PrincipalScopeOverride',
            fieldName: 'createPrincipalScopeOverride',
            document,
            variables,
        });
    }
}
