def METHOD_NAME(cls, resource_id: Optional[str]) -> List[ResourceState]:
    history = cls.history_by_id(resource_id)
    states = []
    previous_state = None
    for resource in history:
        state = resource.status.state
        if state != previous_state:
            states.append(state)
        previous_state = state
    return states