Non-Fiction: purports to be an accurate portray of real life. Reason to write:You know 'what happened' and think other people want to know
mainstream Fiction: purports to be a realistic portray of possible actions in the real world. Reason to write: you do not know what happened, but are reasonably sure about what is possible.
Science-Fiction: purports to be a portrayal of a logically consistent possible reality that strictly abides by rules and laws similar but not identical to the real world. Reason to write: You have a story to tell, can abide by strict rules, but are not sure what is possible, so you make it up and stick to it..
Fantasy: purports to be a portrayal of a consistent possible reality without bothering to strictly abide by any rules. More interested in character relationships than laws of science. Reason to write: You have a story to tell, it requires breaking certain existing, known physical rules, but the story is more important than the rules.
P.S. Stories that involve sword fighting - even if they are 'light sabers' - are never Science Fiction, no matter that they are cloaked in the traditional words of Science Fiction. If they are not historical in nature, they are most likely Fantasy, as they are explicitly breaking known rules - for example the known rule that you DON'T BRING A KNIFE TO A GUNFIGHT.