import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class PlatformResourceEventModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('PlatformResourceEvent', 'platformResourceEvents', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'PlatformResourceEventFilter', 'PlatformResourceEventOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformResourceEvent',
            fieldName: 'platformResourceEvents',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('PlatformResourceEvent', 'platformResourceEvents', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
        }, 'PlatformResourceEventFilter', 'PlatformResourceEventOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformResourceEvent',
            fieldName: 'platformResourceEvent',
            document,
            variables,
            transform: (data) => ({
                platformResourceEvent: data.platformResourceEvents?.nodes?.[0] ?? null,
            }),
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('PlatformResourceEvent', 'platformResourceEvents', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'PlatformResourceEventFilter', 'PlatformResourceEventOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'PlatformResourceEvent',
            fieldName: 'platformResourceEvent',
            document,
            variables,
            transform: (data) => ({
                platformResourceEvent: data.platformResourceEvents?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('PlatformResourceEvent', 'createPlatformResourceEvent', 'platformResourceEvent', args.select, args.data, 'CreatePlatformResourceEventInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformResourceEvent',
            fieldName: 'createPlatformResourceEvent',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('PlatformResourceEvent', 'updatePlatformResourceEvent', 'platformResourceEvent', args.select, args.where.id, args.data, 'UpdatePlatformResourceEventInput', 'id', 'platformResourceEventPatch', connectionFieldsMap, {
            createdAt: args.where.createdAt,
        });
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformResourceEvent',
            fieldName: 'updatePlatformResourceEvent',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('PlatformResourceEvent', 'deletePlatformResourceEvent', 'platformResourceEvent', {
            id: args.where.id,
            createdAt: args.where.createdAt,
        }, 'DeletePlatformResourceEventInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'PlatformResourceEvent',
            fieldName: 'deletePlatformResourceEvent',
            document,
            variables,
        });
    }
}
