Help in writing a tricky if statement

Hello,

I am creating this 2D game where a ball is move to the left. It will hit a log that is tilted at 45 degrees (or at least the image says so), and when the ball hits it it will either move upwards or downwards depending on the rotation of the log (which the user can modify).

What are the conditions I must write? Here’s the code I have.

private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "Ball")
        {
            //case1
            collision.gameObject.GetComponent<Rigidbody2D>().velocity = new Vector2(collision.gameObject.GetComponent<Rigidbody2D>().velocity.y, collision.gameObject.GetComponent<Rigidbody2D>().velocity.x);
            //case2
            collision.gameObject.GetComponent<Rigidbody2D>().velocity = new Vector2(collision.gameObject.GetComponent<Rigidbody2D>().velocity.y, -collision.gameObject.GetComponent<Rigidbody2D>().velocity.x);
            //case3
            collision.gameObject.GetComponent<Rigidbody2D>().velocity = new Vector2(-collision.gameObject.GetComponent<Rigidbody2D>().velocity.y, collision.gameObject.GetComponent<Rigidbody2D>().velocity.x);
            //case4
            collision.gameObject.GetComponent<Rigidbody2D>().velocity = new Vector2(-collision.gameObject.GetComponent<Rigidbody2D>().velocity.y, -collision.gameObject.GetComponent<Rigidbody2D>().velocity.x);

        }
    }

This seems to be a problem that could be solved easier by the Law of Reflection.