<template>
  <div id="app">
    <header>
      <h1>Sebin Nyshkim Character Reference Page</h1>
    </header>

    <h2>Quick info</h2>
    <dict-table :collection="getSebinData.generic" :keyHeader="`Key`" :valueHeader="`Value`"></dict-table>

    <h2>Colors</h2>
    <dict-table
      :collection="getSebinData.colors"
      :keyHeader="`Body Part`"
      :valueHeader="`Color (hex)`"
    ></dict-table>

    <h2>Penis</h2>
    <dict-table :collection="getSebinData.penis" :keyHeader="`Key`" :valueHeader="`Value`"></dict-table>

    <h2>Anatomy</h2>
    <p>Sebin is a bipedal plantigrade. His body is mostly covered by red scales with yellow chest plates running from below his chin over his torso all the way down between his legs and underside of his tail. His physique is athletic to muscular. His fingers and toes are equipped sharp black claws. Brown spikes run along his spine down to the tip of his tail. His tail is about one meter in length.</p>
    <p>His wing span is around 3-4 meters. He has them closed when on the ground. His wings function like a second pair of arms, at which ends are hand-like limbs with a black talon on top and finger-like extensions, in between which are the membranes of his wings. He can use his wings to fly short distances. Longer distances become difficult due to fatigue of having to carry his own weight with his wings alone.</p>
    <p>He has round pupils instead of the slit ones typical for reptilians. He has short yellow spikes above his eyes that resemble eyebrows, as well as spikes along the jawline of his cheeks. He has black horns growing out of his head which are mostly straight but slightly curve downwards. His hair is blue and he wears it in varying styles. He has long pointy ears which he can move to determine the origin of sounds around him. He also uses them to express emotion. His teeth are very sharp. In his throat are glands that produce a mixture that allows him to breathe fire. His tongue has a pointy tip.</p>
    <p>Despite his majorly reptilian appearance he has nipples, a feature of the human side of his family, which also shows with his external testicles. Rather than a slit which houses his penis he has a pouch-like sheath, with the tip slightly peeking out of it. His penis is mainly humanoid in shape but is surrounded by several ridges. He can take it out of its pouch while it's still soft (e.g. for passing water). When erect his charcoal black shaft protrudes from the pouch, its base girded by the sheath like a ring.</p>

    <h2>Personality</h2>
    <p>Sebin is an affectionate guy who cares immensely for his loved ones. If he notices someone having a hard time he always tries to lift them back up again. He will protect them no matter what. Not being able to help a friend in need equals to failing them for him and he will feel extremely guilty for it.</p>
    <p>He is honest and direct about his feelings and doesn't mince words, which some people might find brash.</p>
    <p>He likes to laugh and is easily amused, sometimes to the point of being utterly childish and immature. He doesn't take himself too serious. His vocabulary is often vulgar, he's not afraid to curse, though he still knows when it's better to stay rationally diplomatic.</p>
    <p>He's very enthusiastic about his hobbies and will talk your ears off if he notices the slightest common interest. Sometimes his passion for certain things might get the better of him though and he gets stubborn, hotheaded and even outright rude in disagreements.</p>
    <p>He can also be quite impatient at times.</p>
    <p>He is also a naughty hornball sometimes. He knows what he's got and he's not afraid to show it off playfully. He loves to wear jockstraps and bottomless briefs. He is vers, with a preference to top.</p>
  </div>
</template>

<script>
import DictTable from "./components/DictionaryTable.vue";

export default {
  name: "app",
  components: {
    DictTable
  },
  data() {
    return {
      firstName: "Sebin",
      middleName: "Antario",
      lastName: "Nyshkim",
      dateOfBirth: new Date("1988-04-25"),
      gender: "male",
      height: 210, // cm
      weight: 97, // kg
      wingspan: 400, // cm
      colors: {
        hairPrimary: "#4b608f",
        hairSecondary: "#6684c0",
        eyes: "#31c215",
        scalesPrimary: "#c64c35",
        scalesSecondary: "#eda958",
        eyebrows: "#eda958",
        tailspikes: "#7f4539",
        horns: "#413a3a",
        claws: "#413a3a",
        nipples: "#413a3a",
        penis: "#413a3a"
      },
      penis: {
        shape: "humanoid",
        type: "grower",
        special: "ridged",
        size: 20, // cm
        girth: 5 // cm
      }
    };
  },
  computed: {
    fullName() {
      return `${this.firstName} ${this.middleName} ${this.lastName}`;
    },
    birthdate() {
      const locale = this.getClientLocale();

      return this.dateOfBirth.toLocaleDateString(locale, {
        year: "numeric",
        month: "long",
        day: "2-digit"
      });
    },
    getSebinData() {
      const generic = [
        ["Full Name", this.fullName],
        ["Date of Birth", this.birthdate],
        ["Sex/Gender", this.gender],
        ["Height", `${this.height} cm (${this.toImperial(this.height)})`],
        ["Weight", `${this.weight} kg (${this.toLbs(this.weight)} lbs)`],
        [
          "Wingspan",
          `${this.wingspan / 100} m (${this.toImperial(this.wingspan)})`
        ]
      ];

      const colors = [
        ["Primary Scale Color", this.colors.scalesPrimary],
        ["Secondary Scale Color", this.colors.scalesSecondary],
        ["Primary Hair Color", this.colors.hairPrimary],
        ["Secondary Hair Color", this.colors.hairSecondary],
        ["Eyes", this.colors.eyes],
        ["Eyebrows", this.colors.eyebrows],
        ["Horns", this.colors.horns],
        ["Claws", this.colors.claws],
        ["Nipples", this.colors.nipples],
        ["Tail Spikes", this.colors.tailspikes]
      ];

      const penis = [
        ["Shape", this.penis.shape],
        ["Type", this.penis.type],
        ["Special Traits", this.penis.special],
        ["Color", this.colors.penis],
        ["Length", `${this.penis.size} cm (${this.toInch(this.penis.size)})`],
        ["Girth", `${this.penis.girth} cm (${this.toInch(this.penis.girth)})`]
      ];

      return { generic, colors, penis };
    }
  },
  methods: {
    getClientLocale() {
      if (navigator.language) {
        return navigator.languages[0];
      } else if (navigator.userLanguage) {
        return navigator.userLanguage; // IE < 11
      } else if (navigator.browserLanguage) {
        return navigator.userLanguage;
      } else if (navigator.systemLanguage) {
        return navigator.systemLanguage;
      }
      // return navigator.language ? navigator.languages[0] : navigator.language;
    },
    toImperial(cm) {
      const realFeet = (cm * 0.3937) / 12;
      const feet = Math.floor(realFeet);
      const inches = Math.round((realFeet - feet) * 12);

      return `${feet}'${inches}"`;
    },
    toInch(cm) {
      return `${Math.round(cm / 2.45)} in`;
    },
    toLbs(kg) {
      const nearExact = kg / 0.45359237;
      const lbs = Math.floor(nearExact);

      return lbs;
    }
  }
};
</script>

<style>
#app {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
  margin-top: 60px;
}

header {
  text-align: center;
}
</style>
