-- Copyright (c) 2024 Huawei Technologies Co., Ltd.
-- openUBMC is licensed under Mulan PSL v2.
-- You can use this software according to the terms and conditions of the Mulan PSL v2.
-- You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2
--
-- THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
-- EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
-- MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
-- See the Mulan PSL v2 for more details.

local state_map = {
    [0] = 'Offline',
    'Partially degraded',
    'Degraded',
    'Optimal',
    'Failed',
    'Not Configured',
    'Interim recovery',
    'Ready for recovery',
    'Recovering',
    'Wrong drive replaced',
    'Drive improperly connected',
    'Expanding',
    'Not available',
    'Queued for expansion',
    'Disabled from SCSI conflict',
    'Ejected',
    'Erase in progress',
    'Unused',
    'Ready to perform predictive spare rebuild',
    'RPI in progress',
    'RPI queued',
    'Encrypted without key',
    'Encryption migration',
    'Encrypted & re-keying',
    'Encrypted with encryption off',
    'Volume encode requested',
    'Encrypted with re-key request',
    'Unsupported',
    'Not Formatted',
    'Formatting',
    'Sanitizing',
    'Initializing',
    'Initialize fail',
    'Deleting',
    'Delete fail',
    'Write protect'
}

return state_map[ProcessingFlow[2].Destination.State] or 'N/A'