import type { PartialDTO, PatchDTO, RequiredSome, Type } from 'ts-gems';
import { SQBAdapter } from './sqb-adapter.js';
import { SqbEntityService } from './sqb-entity-service.js';
/**
 * @namespace SqbSingletonService
 */
export declare namespace SqbSingletonService {
    interface Options extends SqbEntityService.Options {
        id?: SqbSingletonService<any>['id'];
    }
    /**
     * Represents options for "create" operation
     *
     * @interface
     */
    interface CreateOptions extends SqbEntityService.CreateOptions {
    }
    /**
     * Represents options for "delete" operation
     *
     * @interface
     */
    interface DeleteOptions extends SqbEntityService.DeleteOptions {
    }
    /**
     * Represents options for "exists" operation
     *
     * @interface
     */
    interface ExistsOptions extends SqbEntityService.ExistsOptions {
    }
    /**
     * Represents options for "find" operation
     *
     * @interface
     */
    interface FindOptions extends SqbEntityService.FindOneOptions {
    }
    /**
     * Represents options for "update" operation
     *
     * @interface
     */
    interface UpdateOptions extends SqbEntityService.UpdateOneOptions {
    }
    /**
     * Represents options for "updateOnly" operation
     *
     * @interface
     */
    interface UpdateOnlyOptions extends SqbEntityService.UpdateOneOptions {
    }
}
/**
 * @class SqbSingletonService
 * @template T - The data type class type of the resource
 */
export declare class SqbSingletonService<T extends object = object> extends SqbEntityService {
    /**
     * Represents a unique identifier for singleton record
     * @property {SQBAdapter.IdOrIds}
     */
    id: SQBAdapter.IdOrIds;
    /**
     * Constructs a new instance
     *
     * @param {Type | string} dataType - The data type of the array elements.
     * @param {SqbSingletonService.Options} [options] - The options for the array service.
     * @constructor
     */
    constructor(dataType: Type<T> | string, options?: SqbSingletonService.Options);
    /**
     * Asserts the existence of a resource based on the given options.
     *
     * @returns {Promise<void>} A Promise that resolves when the resource exists.
     * @throws {ResourceNotAvailableError} If the resource does not exist.
     */
    assert(options?: SqbSingletonService.ExistsOptions): Promise<void>;
    /**
     * Inserts a single record into the database.
     *
     * @param {PartialDTO<T>} input - The input data
     * @param {SqbSingletonService.CreateOptions} [options] - The options object
     * @returns {Promise<PartialDTO<T>>} A promise that resolves to the created resource
     * @throws {Error} if an unknown error occurs while creating the resource
     */
    create(input: PartialDTO<T>, options: RequiredSome<SqbSingletonService.CreateOptions, 'projection'>): Promise<PartialDTO<T>>;
    create(input: PartialDTO<T>, options?: SqbSingletonService.CreateOptions): Promise<T>;
    /**
     * Deletes the singleton record
     *
     * @param {SqbSingletonService.DeleteOptions} [options] - The options object
     * @return {Promise<number>} - A Promise that resolves to the number of records deleted
     */
    delete(options?: SqbSingletonService.DeleteOptions): Promise<number>;
    /**
     * Checks if the singleton record exists.
     *
     * @param {SqbSingletonService.ExistsOptions} [options] - The options for the query (optional).
     * @return {Promise<boolean>} - A Promise that resolves to a boolean indicating whether the record exists or not.
     */
    exists(options?: SqbSingletonService.ExistsOptions): Promise<boolean>;
    /**
     * Finds the singleton record. Returns `undefined` if not found
     *
     * @param {SqbSingletonService.FindOneOptions} options - The options for the query.
     * @return {Promise<PartialDTO<T> | undefined>} A promise that resolves with the found document or undefined if no document is found.
     */
    find(options: RequiredSome<SqbSingletonService.FindOptions, 'projection'>): Promise<PartialDTO<T> | undefined>;
    find(options?: SqbSingletonService.FindOptions): Promise<T | undefined>;
    /**
     * Retrieves the singleton record. Throws error if not found.
     *
     * @param {SqbSingletonService.FindOptions} [options] - Optional options for the `find` operation.
     * @returns {Promise<PartialDTO<T>>} - A promise that resolves to the retrieved document,
     *    or rejects with a ResourceNotFoundError if the document does not exist.
     * @throws {ResourceNotAvailableError} - If the document does not exist.
     */
    get(options: RequiredSome<SqbSingletonService.FindOptions, 'projection'>): Promise<PartialDTO<T>>;
    get(options?: SqbSingletonService.FindOptions): Promise<T>;
    /**
     * Updates the singleton.
     *
     * @param {PatchDTO<T>} input - The partial input object containing the fields to update.
     * @param {SqbSingletonService.UpdateOptions} [options] - The options for the update operation.
     * @returns {Promise<PartialDTO<T> | undefined>} A promise that resolves to the updated document or
     * undefined if the document was not found.
     */
    update(input: PatchDTO<T>, options: RequiredSome<SqbSingletonService.UpdateOptions, 'projection'>): Promise<PartialDTO<T> | undefined>;
    update(input: PatchDTO<T>, options?: SqbSingletonService.UpdateOptions): Promise<T | undefined>;
    /**
     * Updates the singleton and  returns updated record count
     *
     * @param {PatchDTO<T>} input - The partial input data to update the document with.
     * @param {SqbSingletonService.UpdateOptions} options - The options for updating the document.
     * @returns {Promise<number>} - A promise that resolves to the number of documents modified.
     */
    updateOnly(input: PatchDTO<T>, options?: SqbSingletonService.UpdateOnlyOptions): Promise<number>;
}
