#ifndef KISO_H
#define KISO_H

#include "drivers/ide/ide.h"

typedef struct __attribute__((packed)) {
    uint8_t type;
    char identifier[5];
    uint8_t version;
} vd_header_t;

typedef struct __attribute__((packed)) {

} iso_dec_datetime_t;

typedef struct __attribute__((packed)) {
    vd_header_t header;
    uint8_t unused;
    uint8_t sys_ident[32];
    uint8_t volume_ident[32];
    uint8_t unused_1[8];
    uint32_t volume_space_sz_le;
    uint32_t volume_space_sz_be;
    uint8_t unused_2[32];
    uint16_t vol_set_sz_le;
    uint16_t vol_set_sz_be;
    uint16_t vol_seq_num_le;
    uint16_t vol_seq_num_be;
    uint16_t logical_blk_sz_le;
    uint16_t logical_blk_sz_be;
    uint32_t path_table_sz_le;
    uint32_t path_table_sz_be;
    uint32_t path_table_l_loc;
    uint32_t opt_path_table_l_loc;
    uint32_t path_table_m_loc;
    uint32_t opt_path_table_m_loc;
    uint8_t root_dir_entry[34];
    uint8_t vol_set_ident_strd[128];
    uint8_t publisher_ident_stra[128];
    uint8_t data_prep_ident_stra[128];
    uint8_t app_ident_stra[128];
    uint8_t copyright_ident_strd[37];
    uint8_t abs_file_ident_strd[37];
    uint8_t bib_file_ident_strd[37];
    iso_dec_datetime_t vol_creation_datetime;
    iso_dec_datetime_t vol_modif_datetime;
    iso_dec_datetime_t vol_expr_datetime;
    iso_dec_datetime_t vol_effective_datetime;
    uint8_t file_struct_version;
    uint8_t unused_3;
    uint8_t app_reserved[512];
    uint8_t reserved[653];
} iso_pvd_t;

typedef struct __attribute__((packed)) {
    uint8_t dir_ident_len;
    uint8_t ext_attrib_len;
    uint32_t location;
    uint16_t parent_idx;
    uint8_t dir_ident_start;
} iso_path_table_entry_t;

void read_iso(ide_device_t* dev);

#endif