#ifndef ASE_H
#define ASE_H

struct ase_error {
    struct string msg;
    struct ase_error *next;
};

struct ase_error_list {
    u64 count;
    struct ase_error *first;
    struct ase_error *last;
};

struct ase_span {
    struct string name;
    u32 start;
    u32 end;
    struct ase_span *next;
};

struct ase_frame {
    u32 index;
    f64 duration;
    struct clip_rect clip;
    struct ase_frame *next;
};

struct ase_decode_image_result {
    struct image_rgba image;
    struct ase_error_list errors;
};

struct ase_decode_sheet_result {
    struct v2 image_size;
    struct v2 frame_size;
    u32 num_frames;
    u32 num_spans;
    struct ase_frame *frame_head;
    struct ase_span *span_head;
    struct ase_error_list errors;
};

struct ase_decode_image_result ase_decode_image(struct arena *arena, struct buffer encoded);
struct ase_decode_sheet_result ase_decode_sheet(struct arena *arena, struct buffer encoded);

#endif
