/**
 * @file messages_p.h
 * @author Radek Krejci <rkrejci@cesnet.cz>
 * @brief libnetconf2's private functions and structures of NETCONF messages.
 *
 * @copyright
 * Copyright (c) 2021 CESNET, z.s.p.o.
 *
 * This source code is licensed under BSD 3-Clause License (the "License").
 * You may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://opensource.org/licenses/BSD-3-Clause
 */

#ifndef NC_MESSAGES_P_H_
#define NC_MESSAGES_P_H_

#include <libyang/libyang.h>

#include "messages_client.h"
#include "messages_server.h"

extern const char *rpcedit_dfltop2str[];
extern const char *rpcedit_testopt2str[];
extern const char *rpcedit_erropt2str[];

struct nc_server_reply {
    NC_RPL type;
};

struct nc_server_reply_data {
    NC_RPL type;
    struct lyd_node *data;
    int free;
    NC_WD_MODE wd;
};

struct nc_server_reply_error {
    NC_RPL type;
    struct lyd_node *err;
};

struct nc_server_rpc {
    struct lyd_node *envp;   /**< NETCONF-specific RPC envelopes */
    struct lyd_node *rpc;    /**< RPC data tree */
};

struct nc_server_notif {
    char *eventtime;        /**< eventTime of the notification */
    struct lyd_node *ntf;   /**< notification data tree of the message */
    int free;
};

struct nc_client_reply_error {
    NC_RPL type;
    struct nc_err *err;
    uint32_t count;
    struct ly_ctx *ctx;
};

struct nc_rpc {
    NC_RPC_TYPE type;
};

struct nc_rpc_act_generic {
    NC_RPC_TYPE type;       /**< NC_RPC_ACT_GENERIC */
    int has_data;           /**< 1 for content.data, 0 for content.xml_str */
    union {
        struct lyd_node *data;  /**< parsed RPC data */
        char *xml_str;          /**< raw XML string */
    } content;
    char free;
};

struct nc_rpc_getconfig {
    NC_RPC_TYPE type;        /**< NC_RPC_GETCONFIG */
    NC_DATASTORE source;     /**< NETCONF datastore being queried */
    char *filter;            /**< either XML subtree (starts with '<') or an XPath (starts with '/' or an alpha) */
    NC_WD_MODE wd_mode;
    char free;
};

struct nc_rpc_edit {
    NC_RPC_TYPE type;        /**< NC_RPC_EDIT */
    NC_DATASTORE target;
    NC_RPC_EDIT_DFLTOP default_op;
    NC_RPC_EDIT_TESTOPT test_opt;
    NC_RPC_EDIT_ERROPT error_opt;
    char *edit_cont;         /**< either URL (starts with aplha) or config (starts with '<') */
    char free;
};

struct nc_rpc_copy {
    NC_RPC_TYPE type;        /**< NC_RPC_COPY */
    NC_DATASTORE target;
    char *url_trg;
    NC_DATASTORE source;
    char *url_config_src;    /**< either URL (starts with aplha) or config (starts with '<') */
    NC_WD_MODE wd_mode;
    char free;
};

struct nc_rpc_delete {
    NC_RPC_TYPE type;        /**< NC_RPC_DELETE */
    NC_DATASTORE target;
    char *url;
    char free;
};

struct nc_rpc_lock {
    NC_RPC_TYPE type;        /**< NC_RPC_LOCK or NC_RPC_UNLOCK */
    NC_DATASTORE target;
};

struct nc_rpc_get {
    NC_RPC_TYPE type;        /**< NC_RPC_GET */
    char *filter;            /**< either XML subtree (starts with '<') or an XPath (starts with '/' or an alpha) */
    NC_WD_MODE wd_mode;
    char free;
};

struct nc_rpc_kill {
    NC_RPC_TYPE type;        /**< NC_RPC_KILL */
    uint32_t sid;
};

struct nc_rpc_commit {
    NC_RPC_TYPE type;        /**< NC_RPC_COMMIT */
    int confirmed;
    uint32_t confirm_timeout;
    char *persist;
    char *persist_id;
    char free;
};

struct nc_rpc_cancel {
    NC_RPC_TYPE type;        /**< NC_RPC_CANCEL */
    char *persist_id;
    char free;
};

struct nc_rpc_validate {
    NC_RPC_TYPE type;        /**< NC_RPC_VALIDATE */
    NC_DATASTORE source;
    char *url_config_src;    /**< either URL (starts with alpha) or config (starts with '<') */
    char free;
};

struct nc_rpc_getschema {
    NC_RPC_TYPE type;        /**< NC_RPC_GETSCHEMA */
    char *identifier;        /**< requested model identifier */
    char *version;           /**< either YANG version (1.0/1.1) or revision date */
    char *format;            /**< model format */
    char free;
};

struct nc_rpc_subscribe {
    NC_RPC_TYPE type;        /**< NC_RPC_SUBSCRIBE */
    char *stream;            /**< stream name */
    char *filter;            /**< either XML subtree (starts with '<') or an XPath (starts with '/' or an alpha) */
    char *start;
    char *stop;
    char free;
};

struct nc_rpc_getdata {
    NC_RPC_TYPE type;        /**< NC_RPC_GETDATA */
    char *datastore;         /**< target datastore identity */
    char *filter;            /**< either XML subtree (starts with '<') or an XPath (starts with '/' or an alpha) */
    char *config_filter;     /**< config filter ("true"/"false") */
    char **origin_filter;    /**< origin filters */
    int origin_filter_count; /**< origin filter count */
    int negated_origin_filter; /**< whether origin filter is negated or not */
    int max_depth;           /**< max depth of returned subtrees, 0 for unlimited */
    int with_origin;         /**< whether to return origin of data */
    NC_WD_MODE wd_mode;
    char free;
};

struct nc_rpc_editdata {
    NC_RPC_TYPE type;        /**< NC_RPC_EDITDATA */
    char *datastore;         /**< target datastore identity */
    NC_RPC_EDIT_DFLTOP default_op;
    char *edit_cont;         /**< either URL (starts with aplha) or config (starts with '<') */
    char free;
};

struct nc_rpc_establishsub {
    NC_RPC_TYPE type;        /**< NC_RPC_ESTABLISHSUB */
    char *filter;            /**< XML subtree (starts with '<'), an XPath (starts with '/'), or reference (start with alpha) */
    char *stream;            /**< stream name */
    char *start;
    char *stop;
    char *encoding;
    char free;
};

struct nc_rpc_modifysub {
    NC_RPC_TYPE type;        /**< NC_RPC_MODIFYSUB */
    uint32_t id;
    char *filter;            /**< XML subtree (starts with '<'), an XPath (starts with '/'), or reference (start with alpha) */
    char *stop;
    char free;
};

struct nc_rpc_deletesub {
    NC_RPC_TYPE type;        /**< NC_RPC_DELETESUB */
    uint32_t id;
};

struct nc_rpc_killsub {
    NC_RPC_TYPE type;        /**< NC_RPC_KILLSUB */
    uint32_t id;
};

struct nc_rpc_establishpush {
    NC_RPC_TYPE type;        /**< NC_RPC_ESTABLISHPUSH */
    char *datastore;
    char *filter;            /**< XML subtree (starts with '<'), an XPath (starts with '/'), or reference (start with alpha) */
    char *stop;
    char *encoding;
    int periodic;
    union {
        struct {
            uint32_t period;
            char *anchor_time;
        };
        struct {
            uint32_t dampening_period;
            int sync_on_start;
            char **excluded_change;
        };
    };
    char free;
};

struct nc_rpc_modifypush {
    NC_RPC_TYPE type;        /**< NC_RPC_MODIFYPUSH */
    uint32_t id;
    char *datastore;
    char *filter;            /**< XML subtree (starts with '<'), an XPath (starts with '/'), or reference (start with alpha) */
    char *stop;
    int periodic;
    union {
        struct {
            uint32_t period;
            char *anchor_time;
        };
        uint32_t dampening_period;
    };
    char free;
};

struct nc_rpc_resyncsub {
    NC_RPC_TYPE type;        /**< NC_RPC_RESYNCSUB */
    uint32_t id;
};

void nc_server_rpc_free(struct nc_server_rpc *rpc);

void nc_client_err_clean(struct nc_err *err, struct ly_ctx *ctx);

#endif /* NC_MESSAGES_P_H_ */
