import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class MembershipTypeModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('MembershipType', 'membershipTypes', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'MembershipTypeFilter', 'MembershipTypeOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'MembershipType',
            fieldName: 'membershipTypes',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('MembershipType', 'membershipTypes', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'MembershipTypeFilter', 'MembershipTypeOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'MembershipType',
            fieldName: 'membershipType',
            document,
            variables,
            transform: (data) => ({
                membershipType: data.membershipTypes?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('MembershipType', 'membershipTypes', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'MembershipTypeFilter', 'MembershipTypeOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'MembershipType',
            fieldName: 'membershipType',
            document,
            variables,
            transform: (data) => ({
                membershipType: data.membershipTypes?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('MembershipType', 'createMembershipType', 'membershipType', args.select, args.data, 'CreateMembershipTypeInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'MembershipType',
            fieldName: 'createMembershipType',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('MembershipType', 'updateMembershipType', 'membershipType', args.select, args.where.id, args.data, 'UpdateMembershipTypeInput', 'id', 'membershipTypePatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'MembershipType',
            fieldName: 'updateMembershipType',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('MembershipType', 'deleteMembershipType', 'membershipType', {
            id: args.where.id,
        }, 'DeleteMembershipTypeInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'MembershipType',
            fieldName: 'deleteMembershipType',
            document,
            variables,
        });
    }
}
