import { QueryBuilder, buildFindManyDocument, buildFindFirstDocument, buildCreateDocument, buildUpdateByPkDocument, buildDeleteByPkDocument, } from '../query-builder';
import { connectionFieldsMap } from '../input-types';
export class SiteMetadatumModel {
    client;
    constructor(client) {
        this.client = client;
    }
    findMany(args) {
        const { document, variables } = buildFindManyDocument('SiteMetadatum', 'siteMetadata', args.select, {
            where: args?.where,
            orderBy: args?.orderBy,
            first: args?.first,
            last: args?.last,
            after: args?.after,
            before: args?.before,
            offset: args?.offset,
        }, 'SiteMetadatumFilter', 'SiteMetadatumOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'SiteMetadatum',
            fieldName: 'siteMetadata',
            document,
            variables,
        });
    }
    findFirst(args) {
        const { document, variables } = buildFindFirstDocument('SiteMetadatum', 'siteMetadata', args.select, {
            where: args?.where,
        }, 'SiteMetadatumFilter', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'SiteMetadatum',
            fieldName: 'siteMetadata',
            document,
            variables,
        });
    }
    findOne(args) {
        const { document, variables } = buildFindManyDocument('SiteMetadatum', 'siteMetadata', args.select, {
            where: {
                id: {
                    equalTo: args.id,
                },
            },
            first: 1,
        }, 'SiteMetadatumFilter', 'SiteMetadatumOrderBy', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'query',
            operationName: 'SiteMetadatum',
            fieldName: 'siteMetadatum',
            document,
            variables,
            transform: (data) => ({
                siteMetadatum: data.siteMetadata?.nodes?.[0] ?? null,
            }),
        });
    }
    create(args) {
        const { document, variables } = buildCreateDocument('SiteMetadatum', 'createSiteMetadatum', 'siteMetadatum', args.select, args.data, 'CreateSiteMetadatumInput', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'SiteMetadatum',
            fieldName: 'createSiteMetadatum',
            document,
            variables,
        });
    }
    update(args) {
        const { document, variables } = buildUpdateByPkDocument('SiteMetadatum', 'updateSiteMetadatum', 'siteMetadatum', args.select, args.where.id, args.data, 'UpdateSiteMetadatumInput', 'id', 'siteMetadatumPatch', connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'SiteMetadatum',
            fieldName: 'updateSiteMetadatum',
            document,
            variables,
        });
    }
    delete(args) {
        const { document, variables } = buildDeleteByPkDocument('SiteMetadatum', 'deleteSiteMetadatum', 'siteMetadatum', {
            id: args.where.id,
        }, 'DeleteSiteMetadatumInput', args.select, connectionFieldsMap);
        return new QueryBuilder({
            client: this.client,
            operation: 'mutation',
            operationName: 'SiteMetadatum',
            fieldName: 'deleteSiteMetadatum',
            document,
            variables,
        });
    }
}
