# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""
satellites
----------

This is a sample dataset build into the engine, this simplifies a few things:

- We can write test scripts using this data, knowing that it will always be available.
- We can write examples using this data, knowing the results will always match.

This data was obtained from:
https://github.com/devstronomy/nasa-data-scraper/blob/master/data/json/satellites.json

Licence @ 02-JAN-2022 when copied - MIT Licences attested, but data appears to be
from NASA, which is Public Domain.

To access this dataset you can either run a query against dataset :satellites: or you
can instantiate a SatelliteData() class and use it like a Relation.

This has a companion dataset, $planets, to help test joins.
"""


from orso.schema import FlatColumn
from orso.schema import RelationSchema
from orso.types import OrsoTypes


def read(*args):
    import base64
    import io

    import pyarrow.parquet as pq

    """The table is saved parquet table, base85 encoded."""

    return pq.read_table(
        io.BytesIO(
            base64.b85decode(
                b"P(e~L6$BNK78RZZOcmk+6$BCh04TLD{a}a$EeHUH);=8&kgpv83;+xO3;+xO3_!^xmt1nmC6`=s$tBY%GXOOJIRLwI-KsS!)~i;lQk^O_D%7V=n=)OhG%3=fMvD?1Dl{n2pFVr?+^I7s&YL!C(wr$XCKXH&!2=B}kiY>23=qJ-e*5y>t2Zy+yLRi+ohvsk+_!GqvR$h-E!wkY%aR={HZ0h$UIA~ku|^talrcsaUv#lW7FSd;MHEjou|yI_6fr~)KlHFe4mZ>=LkusputEwalrTaFA9S!m1{VbXFv0xN%PzUxQp+r{ywb`lshm>ED4~4P$tIaxQpqHdJkrP_i5ybMAc6eR#~yjyQO6u{1c0zq0ssR66#x~20~M45EEVDc6$BLq6$Ts_2(bVF0000002l}X000000000M04NBt000000000O2mt^90000000000D77#BAi)U+00RI30OA4x2rmEu0s{mE1_uZU3JVMk4i69!5)%{^78e*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|w)DK|w)6ZemeEK|w)5M?pbnK|*IiM?pbBK|w)5LqSVKFE1}RK|w)9MnyqEK|w-yK|w)5ML|J9K|w)5K|w)LK|w)6by-(2Y(YUmK|w)LK|(=6ML|J9L3&UxFE4jNK|xVTQ9(gLK}bPCK|w)LK|w)5K|w)5K|?`7K|x4Db6Hn4Y-B}jYe7LlK|xJaFE1}RK|w)5LQz3MK|w-6K}JDANkKtbK|*&yO+i6HK}A79Q9(gLK|w)5LP2OjK|w)5V?jYdK|(=6K|w)5K|w)5LqS17L19->K|w)hK}118NkKtlK|?`7K|w)5K|w)AK|w)5K>!#ZaA9(Bb!BudV{mXSVRCYBcOZ6Ua&u{KZXh)-FfK3|j2r*}8~^|u000~S02}}S8~^|u000~S003PE002-yQZW"
            )
        )
    )


def schema():
    # fmt:off
    return RelationSchema(
            name="$satellites",
            columns=[
                FlatColumn(name="id", type=OrsoTypes.INTEGER),
                FlatColumn(name="planetId", type=OrsoTypes.INTEGER, aliases=["planet_id"]),
                FlatColumn(name="name", type=OrsoTypes.VARCHAR),
                FlatColumn(name="gm", type=OrsoTypes.DOUBLE),
                FlatColumn(name="radius", type=OrsoTypes.DOUBLE),
                FlatColumn(name="density", type=OrsoTypes.DOUBLE),
                FlatColumn(name="magnitude", type=OrsoTypes.DOUBLE),
                FlatColumn(name="albedo", type=OrsoTypes.DOUBLE),
            ],
        )
