import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class OrgMembershipDefaultModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('OrgMembershipDefault', 'orgMembershipDefaults', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'OrgMembershipDefaultFilter', 'OrgMembershipDefaultOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgMembershipDefault',
            fieldName: 'orgMembershipDefaults',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('OrgMembershipDefault', 'orgMembershipDefaults', args.select, {
            where: args?.where,
        }, 'OrgMembershipDefaultFilter', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgMembershipDefault',
            fieldName: 'orgMembershipDefaults',
            document,
            variables,
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('OrgMembershipDefault', 'orgMembershipDefaults', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'OrgMembershipDefaultFilter', 'OrgMembershipDefaultOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'OrgMembershipDefault',
            fieldName: 'orgMembershipDefault',
            document,
            variables,
            transform: (data) => ({
                orgMembershipDefault: data.orgMembershipDefaults?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('OrgMembershipDefault', 'createOrgMembershipDefault', 'orgMembershipDefault', args.select, args.data, 'CreateOrgMembershipDefaultInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgMembershipDefault',
            fieldName: 'createOrgMembershipDefault',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('OrgMembershipDefault', 'updateOrgMembershipDefault', 'orgMembershipDefault', args.select, args.where.id, args.data, 'UpdateOrgMembershipDefaultInput', 'id', 'orgMembershipDefaultPatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgMembershipDefault',
            fieldName: 'updateOrgMembershipDefault',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('OrgMembershipDefault', 'deleteOrgMembershipDefault', 'orgMembershipDefault', {
            id: args.where.id,
        }, 'DeleteOrgMembershipDefaultInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'OrgMembershipDefault',
            fieldName: 'deleteOrgMembershipDefault',
            document,
            variables,
        });
    }
}
