#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
fetchez.modules.checkpoints_3dep
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

3DEP elevation checkpoints

:copyright: (c) 2010-2026 Regents of the University of Colorado
:license: MIT, see LICENSE for more details.
"""

from fetchez.modules import FetchModule
from fetchez import cli

CHECKPOINTS_3DEP_URL = "https://www.sciencebase.gov/catalog/file/get/67075e6bd34e969edc59c3e7?f=__disk__80%2F12%2F9e%2F80129e86d18461ed921b288f13e08c62e8590ffb"
REFERER = "https://www.sciencebase.gov/vocab/category/item/identifier"

HEADERS = {
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:89.0) Gecko/20100101 Firefox/89.0",
    "referer": REFERER,
}


@cli.cli_opts(help_text="USGS 3DEP Elevation Checkpoints")
class CheckPoints3DEP(FetchModule):
    name = "3dep_cp"
    meta_category = "Reference"
    meta_desc = "USGS 3DEP Elevation Validation Checkpoints"
    meta_agency = "USGS"
    meta_tags = [
        "usgs",
        "3dep",
        "checkpoints",
        "validation",
        "accuracy",
        "control-points",
    ]
    meta_region = "USA"
    meta_resolution = "Point Data"
    meta_license = "Public Domain"
    meta_urls = {
        "home": "https://www.usgs.gov/3d-elevation-program",
        "source": "https://www.sciencebase.gov/catalog/item/67075e6bd34e969edc59c3e7",
    }

    def __init__(self, **kwargs):
        super().__init__(name="3dep_cp", **kwargs)
        self.headers = HEADERS

    def run(self):
        self.add_entry_to_results(
            url=CHECKPOINTS_3DEP_URL,
            dst_fn="CheckPoints_3DEP.zip",
            data_type="checkpoints",
            agency="USGS",
            title="3DEP Elevation Checkpoints",
            region="USA",
            format="Shapefile (zipped)",
            license="Public Domain",
        )
