I think a lot of stories are inspired by real events, and Job could be one of those. Perhaps there was a very good man who was very well off, but suddenly struck with tragedy, perhaps with friends who tried to explain it, and maybe a wife who told him to curse God and die, etc. etc. Someone padded the story with God bragging about Job and Satan challenging Him and several chapters of God bragging about Himself and belittling Job, when Job was at the lowest point of his life. (And what are we to learn of God's character from this?

)