import { serializePropertyRef } from "../refs.js";
class QueryImpl {
    #schema;
    #name;
    #query;
    #ref;
    constructor(parent, entry) {
        this.#schema = parent;
        this.#name = entry.name;
        this.#query = entry.query;
        this.#ref = entry.ref;
    }
    get ref() {
        return serializePropertyRef(this.#ref);
    }
    get argsSchema() {
        const args = this.#query.args;
        if (args) {
            if (typeof args === 'object') {
                return this.#schema.dereferenceObjectSchema(args);
            }
            return this.#schema.getShape(args)?.getObjectSchema();
        }
        return undefined;
    }
    get type() {
        return this.#ref.shapeName === 'Mutation' ? 'mutation' : 'query';
    }
    get name() {
        return this.#name;
    }
    get json() {
        return this.#query;
    }
}
export function createQuery(parent, entry) {
    return new QueryImpl(parent, entry);
}
