/*  *********************************************************************
 *  ASTRIS - Remote JTAG probe
 *
 *  Apple Product Declaration
 *
 *  File: astris_product.h
 *
 *
 ***********************************************************************
 *
 *  Copyright (C) 2021 Apple Inc. All rights reserved.
 *
 *  This document is the property of Apple Inc.
 *  It is considered confidential and proprietary.
 *
 *  This document may not be reproduced or transmitted in any form,
 *  in whole or in part, without the express written permission of
 *  Apple Inc.
 ********************************************************************* */

#ifndef astris_product_h
#define astris_product_h

#include "astris_api.h"
#include "astris_product_info.h"
#include <vector>
#include <string>
#include <sstream>

struct prod_desc_t;

class MatchType_t {
public:
    int32_t bid;
    int32_t sdom;

    MatchType_t();
    bool equals(std::shared_ptr <MatchType_t> match_key);

};

class AppleProduct_t {
public:
    AppleProduct_t();
    AppleProduct_t(prod_desc_t *prod);
    ~AppleProduct_t();

    int get_bypass_info(const char *name, AXbypass_config_t &out_config);

    std::vector <AXbypass_config_t> get_all_bypass_configs() {return bypass_layout;}

    void        fill_pmu_info();
    std::string get_description();

    std::string product_name;
    std::shared_ptr <MatchType_t> match_info;
    const char *pmu_name;
    pmu_type_e pmu;
    astris_spmi_dev_addr_t pmu_spmi_addr;
    astris_spmi_reg_addr_t pmu_sram_base_addr;
    astris_spmi_reg_addr_t pmu_socd_offset;
    AXdfu_type_t dfu_mode;
    bool hard_dfu_support;
    uint32_t board_id;
    uint32_t sdom;

protected:
    std::vector <AXbypass_config_t> bypass_layout;
};

#endif /* astris_product_h */
