<script lang="ts">
    import type { OB_Pis_SimpleObject } from "@owlboard/ts-types";

    export let pisObject: OB_Pis_SimpleObject;
</script>

{#if pisObject}
    {#if typeof pisObject === "string" || typeof pisObject === "number"}
        <span class="pis">PIS: {pisObject}</span>
    {:else if pisObject["skipCount"] === 0}
        <span class="pis">PIS: {pisObject.code}</span>
    {:else if pisObject["skipCount"] > 0}
        <span class="pis">PIS: {pisObject.code}</span>
        <br />
        <span class="pis-text"
            >(skip {pisObject.skipType}{#if pisObject.skipCount > 1} {" " + pisObject.skipCount} stops{:else} stop{/if})</span
        >
    {/if}
{/if}

<style>
    .pis-text {
        font-size: 14px;
        font-weight: 600;
        color: var(--main-text-color);
    }

    .pis {
        font-size: 18px;
        font-weight: 600;
        color: var(--main-text-color);
    }
</style>
