ALTER TABLE `vn`.`state` ADD classColor varchar(12) NULL;

UPDATE `vn`.`state` s
    SET s.classColor = 'warning'
        WHERE s.alertLevel = 1;

UPDATE `vn`.`state` s
    SET s.classColor = 'alert'
        WHERE s.alertLevel = 0;

UPDATE `vn`.`state` s
    SET s.classColor = 'success'
        WHERE s.code LIKE 'OK';

UPDATE `vn`.`state` s
    SET s.classColor = 'notice'
        WHERE s.code LIKE 'FREE';

UPDATE `vn`.`state` s
    SET s.classColor = 'success'
        WHERE s.order >= 4 
            AND (s.alertLevel = 0 OR s.alertLevel = 1);

UPDATE `vn`.`state` s
    SET s.classColor = 'warning'
        WHERE s.code IN ('PREVIOUS_PREPARATION', 'PREPARED', 'ON_PREPARATION', 'ON_CHECKING', 'CHECKED');
