Joseph lived all his life confronting schemes made by the people closest to him. His brothers plotted to kill him, but they amended it to exiling him. This happened to him while he was a boy. He was sold into the slave market in Egypt, where he was bought for a nominal sum. Then he fell victim to the attempted seduction by a great man's wife who, when her wish was foiled, sent him to prison, where he remained for some time. In spite of all this, he at length approached close to the Egyptian throne and became the king's chief minister. He then began his call to Allah from the position of the ruling authority.
Allah's plans were carried out, and the matter ended. This is the substance (theme) of the story. As for the form (style) in which it is presented, it is a landmark of wonder.