aboutsummaryrefslogtreecommitdiff
path: root/src/action.h
blob: 795a79cafac2262ba2545c34958905d9127a409a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef COMET_ACTION_H
#define COMET_ACTION_H

#include <stdbool.h>

#include "config.h"

typedef enum {
    ACTION_TARGET,
    ACTION_SET_PAIR,
    ACTION_RUN_SYNC,
    ACTION_RUN_ASYNC,
} action_type_t;

typedef struct {
    action_type_t type;
    char *key;
    char *value;
} action_part_t;

struct action {
    char *label;
    action_part_t *parts;
    size_t length;
    bool validated;
    bool resolved;
};

typedef struct action action_t;

bool action_perform(action_t *action, block_t *block, config_t *config);

int action_validate(action_t *action, config_t *config);

bool action_resolve(action_t *action, config_t *config);

void action_free(action_t *action);

#endif