/*
 * Copyright (C) 2023, KylinSoft Co., Ltd.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this library.  If not, see <https://www.gnu.org/licenses/>.
 *
 * Authors: tianshaoshuai <tianshaoshuai@kylinos.cn>
 *
 */

#ifndef KYSETTINGS_H
#define KYSETTINGS_H

#if __cplusplus
extern "C"
{
#endif

    typedef struct  _KSettings KSettings;

    typedef void    (*KCallBack)                    (void);
    // typedef void    (*KCallBack)                    (KSettings *ksettings,
    //                                                  const char *key,
    //                                                  void *user_data);

    KSettings *     kdk_conf2_new                   (const char         *id,
                                                     const char         *version);

    void            kdk_conf2_ksettings_destroy     (KSettings          *ksettings);

    char *          kdk_conf2_get_id                (KSettings          *ksettings);

    char *          kdk_conf2_get_version           (KSettings          *ksettings);
    
    KSettings *     kdk_conf2_get_child             (KSettings          *ksettings,
                                                     const char         *name);

    char **         kdk_conf2_list_children         (KSettings          *ksettings);

    char **         kdk_conf2_list_keys             (KSettings          *ksettings);

    char *          kdk_conf2_get_range             (KSettings          *ksettings,
                                                     const char         *key);

    int             kdk_conf2_range_check           (KSettings          *ksettings,
                                                     const char         *key,
                                                     const char         *value);

    int             kdk_conf2_set_value             (KSettings          *ksettings,
                                                     const char         *key,
                                                     const char         *value);

    char *          kdk_conf2_get_value             (KSettings          *ksettings,
                                                     const char         *key);

    char *          kdk_conf2_get_default_value     (KSettings          *ksettings,
                                                     const char         *key);

    int             kdk_conf2_set_boolean           (KSettings          *ksettings,
                                                     const char         *key,
                                                     int                 value);

    int             kdk_conf2_get_boolean           (KSettings          *ksettings,
                                                     const char         *key);

    int             kdk_conf2_get_default_boolean   (KSettings          *ksettings,
                                                     const char         *key);

    int             kdk_conf2_set_double            (KSettings          *ksettings,
                                                     const char         *key,
                                                     double              value);

    double          kdk_conf2_get_double            (KSettings          *ksettings,
                                                     const char         *key);

    double          kdk_conf2_get_default_double    (KSettings          *ksettings,
                                                     const char         *key);

    int             kdk_conf2_set_enum              (KSettings          *ksettings,
                                                     const char         *key,
                                                     int                 value);

    int             kdk_conf2_get_enum              (KSettings          *ksettings,
                                                     const char         *key);

    int             kdk_conf2_get_default_enum      (KSettings          *ksettings,
                                                     const char         *key);

    int             kdk_conf2_set_int               (KSettings          *ksettings,
                                                     const char         *key,
                                                     int                 value);

    int             kdk_conf2_get_int               (KSettings          *ksettings,
                                                     const char         *key);

    int             kdk_conf2_get_default_int       (KSettings          *ksettings,
                                                     const char         *key);

    int             kdk_conf2_set_int64             (KSettings          *ksettings,
                                                     const char         *key,
                                                     long               value);

    long            kdk_conf2_get_int64             (KSettings          *ksettings,
                                                     const char         *key);

    long            kdk_conf2_get_default_int64     (KSettings          *ksettings,
                                                     const char         *key);

    int             kdk_conf2_set_uint              (KSettings          *ksettings,
                                                     const char         *key,
                                                     unsigned int        value);

    unsigned int    kdk_conf2_get_uint              (KSettings          *ksettings,
                                                     const char         *key);

    unsigned int    kdk_conf2_get_default_uint      (KSettings          *ksettings,
                                                     const char         *key);

    int             kdk_conf2_set_uint64            (KSettings          *ksettings,
                                                     const char         *key,
                                                     unsigned long       value);

    unsigned long   kdk_conf2_get_uint64            (KSettings          *ksettings,
                                                     const char         *key);

    unsigned long   kdk_conf2_get_default_uint64    (KSettings          *ksettings,
                                                     const char         *key);

    int             kdk_conf2_set_string            (KSettings          *ksettings,
                                                     const char         *key,
                                                     const char         *value);

    char *          kdk_conf2_get_string            (KSettings          *ksettings,
                                                     const char         *key);

    char *          kdk_conf2_get_default_string    (KSettings          *ksettings,
                                                     const char         *key);

    int             kdk_conf2_set_strv              (KSettings          *ksettings,
                                                     const char         *key,
                                                     const char * const *value);

    char **         kdk_conf2_get_strv              (KSettings          *ksettings,
                                                     const char         *key);

    char **         kdk_conf2_get_default_strv      (KSettings          *ksettings,
                                                     const char         *key);

    char *          kdk_conf2_get_descrition        (KSettings          *ksettings,
                                                     const char         *key);

    char *          kdk_conf2_get_summary           (KSettings          *ksettings,
                                                     const char         *key);

    char *          kdk_conf2_get_type              (KSettings          *ksettings,
                                                     const char         *key);

    void            kdk_conf2_reset                 (KSettings          *ksettings,
                                                     const char         *key);

    int             kdk_conf2_is_writable           (KSettings          *ksettings,
                                                     const char         *key);

    int             kdk_conf2_has_key               (KSettings          *ksettings, 
                                                     const char         *key);

    unsigned long   kdk_conf2_connect_signal        (KSettings          *ksettings,
                                                     const char         *signal_name,
                                                     KCallBack           handler,
                                                     void               *user_data);
    void            kdk_conf2_reload                (void);

    char **         kdk_conf2_list_schemas          (const char         *app,
                                                     const char         *version);

    int             kdk_conf2_save_user_configure   (const char         *path);
















#if __cplusplus
}
#endif // extern "C"

#endif // KYSETTINGS_H
