import type { SqlElement } from '@sqb/builder';
import type { PartialDTO, PatchDTO, RequiredSome, Type } from 'ts-gems';
import { SQBAdapter } from './sqb-adapter.js';
import { SqbEntityService } from './sqb-entity-service.js';
/**
 * Options for SqbSingletonService.
 */
export declare namespace SqbSingletonService {
    /**
     * Configuration options for SqbSingletonService.
     */
    interface Options extends SqbEntityService.Options {
        /**
         * The identifier used to locate the singleton record.
         */
        id?: SqbSingletonService<any>['id'];
    }
}
/**
 * Service for managing a single entity record backed by an SQB data source.
 *
 * @typeParam T - The entity type managed by this service
 */
export declare class SqbSingletonService<T extends object = object> extends SqbEntityService<T> {
    /**
     * The identifier used to locate the singleton record.
     */
    id: SQBAdapter.IdOrIds;
    /**
     * Constructs a new instance.
     *
     * @param dataType - The entity class or its registered name.
     * @param options - Options for the singleton service.
     */
    constructor(dataType: Type<T> | string, options?: SqbSingletonService.Options);
    /**
     * Asserts that the singleton record exists.
     * Throws {@link ResourceNotAvailableError} if it does not.
     *
     * @param options - Optional existence check options.
     * @throws {@link ResourceNotAvailableError} If the record does not exist.
     */
    assert(options?: SqbEntityService.ExistsOptions): Promise<void>;
    /**
     * Creates the singleton record and returns it with the requested projection.
     *
     * @param input - The input data for the new record.
     * @param options - Options including a required `projection`.
     * @returns The created record as a partial DTO.
     */
    create(input: PartialDTO<T>, options: RequiredSome<SqbEntityService.CreateOptions, 'projection'>): Promise<PartialDTO<T>>;
    /**
     * Creates the singleton record and returns the full DTO.
     *
     * @param input - The input data for the new record.
     * @param options - Optional create options.
     * @returns The created record as a full DTO.
     */
    create(input: PartialDTO<T>, options?: SqbEntityService.CreateOptions): Promise<T>;
    /**
     * Deletes the singleton record.
     *
     * @param options - Optional delete options.
     * @returns The number of records deleted.
     */
    delete(options?: SqbEntityService.DeleteOptions): Promise<number>;
    /**
     * Checks whether the singleton record exists.
     *
     * @param options - Optional query options.
     * @returns `true` if the record exists, `false` otherwise.
     */
    exists(options?: SqbEntityService.ExistsOptions): Promise<boolean>;
    /**
     * Finds the singleton record with the requested projection.
     * Returns `undefined` if it does not exist.
     *
     * @param options - Options including a required `projection`.
     * @returns The record as a partial DTO, or `undefined`.
     */
    find(options: RequiredSome<SqbEntityService.FindOneOptions, 'projection'>): Promise<PartialDTO<T> | undefined>;
    /**
     * Finds the singleton record. Returns `undefined` if it does not exist.
     *
     * @param options - Optional query options.
     * @returns The record as a full DTO, or `undefined`.
     */
    find(options?: SqbEntityService.FindOneOptions): Promise<T | undefined>;
    /**
     * Retrieves the singleton record with the requested projection.
     * Throws if the record does not exist.
     *
     * @param options - Options including a required `projection`.
     * @returns The record as a partial DTO.
     * @throws {@link ResourceNotAvailableError} If the record does not exist.
     */
    get(options: RequiredSome<SqbEntityService.FindOneOptions, 'projection'>): Promise<PartialDTO<T>>;
    /**
     * Retrieves the singleton record. Throws if it does not exist.
     *
     * @param options - Optional query options.
     * @returns The record as a full DTO.
     * @throws {@link ResourceNotAvailableError} If the record does not exist.
     */
    get(options?: SqbEntityService.FindOneOptions): Promise<T>;
    /**
     * Updates the singleton record and returns it with the requested projection.
     *
     * @param input - The fields to update.
     * @param options - Options including a required `projection`.
     * @returns The updated record as a partial DTO, or `undefined` if not found.
     */
    update(input: PatchDTO<T, SqlElement>, options: RequiredSome<SqbEntityService.UpdateOneOptions, 'projection'>): Promise<PartialDTO<T> | undefined>;
    /**
     * Updates the singleton record and returns the full DTO.
     *
     * @param input - The fields to update.
     * @param options - Optional update options.
     * @returns The updated record as a full DTO, or `undefined` if not found.
     */
    update(input: PatchDTO<T, SqlElement>, options?: SqbEntityService.UpdateOneOptions): Promise<T | undefined>;
    /**
     * Updates the singleton record without returning it.
     *
     * @param input - The fields to update.
     * @param options - Optional update options.
     * @returns The number of records modified.
     */
    updateOnly(input: PatchDTO<T, SqlElement>, options?: SqbEntityService.UpdateOneOptions): Promise<number>;
}
