/*****************************************************************************
 * Copyright (c) 2014-2026 OpenRCT2 developers
 *
 * For a complete list of all authors, please refer to contributors.md
 * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
 *
 * OpenRCT2 is licensed under the GNU General Public License version 3.
 *****************************************************************************/

#pragma once

#include "../../SpriteIds.h"
#include "../../world/Location.hpp"

#include <cstdint>
#include <optional>

struct PaintSession;

namespace OpenRCT2
{
    struct SurfaceElement;
}

namespace OpenRCT2::Drawing
{
    enum class Colour : uint8_t;
}

enum
{
    SPR_TERRAIN_GRASS = 1915,
    SPR_TERRAIN_GRASS_GRID = 1934,
    SPR_TERRAIN_GRASS_UNDERGROUND = 1953,
    SPR_TERRAIN_SAND = 1972,
    SPR_TERRAIN_SAND_GRID = 1991,
    SPR_TERRAIN_SAND_UNDERGROUND = 2010,
    SPR_TERRAIN_SAND_RED = 2029,
    SPR_TERRAIN_SAND_RED_GRID = 2048,
    SPR_TERRAIN_SAND_RED_UNDERGROUND = 2067,
    SPR_TERRAIN_SAND_YELLOW = 2086,
    SPR_TERRAIN_SAND_YELLOW_GRID = 2105,
    SPR_TERRAIN_SAND_YELLOW_UNDERGROUND = 2124,
    SPR_TERRAIN_ICE = 2143,
    SPR_TERRAIN_ICE_GRID = 2162,
    SPR_TERRAIN_ICE_UNDERGROUND = 2181,
    SPR_TERRAIN_GRASS_CLUMPS = 2200,
    SPR_TERRAIN_GRASS_CLUMPS_GRID = 2219,
    SPR_TERRAIN_GRASS_CLUMPS_UNDERGROUND = 2238,
    SPR_TERRAIN_GRID = 2257,
    SPR_TERRAIN_GRID_GRID = 2276,
    SPR_TERRAIN_GRID_UNDERGROUND = 2295,
    SPR_TERRAIN_MARTIAN = 2314,
    SPR_TERRAIN_MARTIAN_GRID = 2333,
    SPR_TERRAIN_MARTIAN_UNDERGROUND = 2352,
    SPR_TERRAIN_CHEQUERBOARD = 2371,
    SPR_TERRAIN_CHEQUERBOARD_GRID = 2390,
    SPR_TERRAIN_CHEQUERBOARD_UNDERGROUND = 2409,
    SPR_TERRAIN_CHEQUERBOARD_INVERTED = 2428,
    SPR_TERRAIN_CHEQUERBOARD_INVERTED_GRID = 2447,
    SPR_TERRAIN_CHEQUERBOARD_INVERTED_UNDERGROUND = 2466,
    SPR_TERRAIN_DIRT = 2485,
    SPR_TERRAIN_DIRT_GRID = 2504,
    SPR_TERRAIN_DIRT_UNDERGROUND = 2523,
    SPR_TERRAIN_ROCK = 2542,
    SPR_TERRAIN_ROCK_GRID = 2561,
    SPR_TERRAIN_ROCK_UNDERGROUND = 2580,
    SPR_TERRAIN_SELECTION_PATROL_AREA = 2599,
    SPR_TERRAIN_TRACK_DESIGNER = 2623,
    SPR_TERRAIN_GRASS_MOWED = 2663,
    SPR_TERRAIN_GRASS_MOWED_GRID = 2682,
    SPR_TERRAIN_GRASS_MOWED_90 = 2701,
    SPR_TERRAIN_GRASS_MOWED_90_GRID = 2720,
    SPR_TERRAIN_GRASS_LENGTH_4_VARIANT_1 = 2739,
    SPR_TERRAIN_GRASS_LENGTH_4_VARIANT_1_GRID = 2758,
    SPR_TERRAIN_GRASS_LENGTH_4_VARIANT_2 = 2777,
    SPR_TERRAIN_GRASS_LENGTH_4_VARIANT_2_GRID = 2796,
    SPR_TERRAIN_GRASS_LENGTH_4_VARIANT_3 = 2815,
    SPR_TERRAIN_GRASS_LENGTH_4_VARIANT_3_GRID = 2834,
    SPR_TERRAIN_GRASS_LENGTH_4_VARIANT_4 = 2853,
    SPR_TERRAIN_GRASS_LENGTH_4_VARIANT_4_GRID = 2872,
    SPR_TERRAIN_GRASS_LENGTH_6_VARIANT_1 = 2891,
    SPR_TERRAIN_GRASS_LENGTH_6_VARIANT_1_GRID = 2910,
    SPR_TERRAIN_GRASS_LENGTH_6_VARIANT_2 = 2929,
    SPR_TERRAIN_GRASS_LENGTH_6_VARIANT_2_GRID = 2948,
    SPR_TERRAIN_GRASS_LENGTH_6_VARIANT_3 = 2967,
    SPR_TERRAIN_GRASS_LENGTH_6_VARIANT_3_GRID = 2986,
    SPR_TERRAIN_GRASS_LENGTH_6_VARIANT_4 = 3005,
    SPR_TERRAIN_GRASS_LENGTH_6_VARIANT_4_GRID = 3024,
    SPR_TERRAIN_SELECTION_CORNER = 3043,
    SPR_TERRAIN_SELECTION_EDGE = 3062,
    SPR_TERRAIN_SELECTION_QUARTER = 3081,
    SPR_WATER_MASK = 5048,
    SPR_WATER_OVERLAY = 5053,

    SPR_TERRAIN_BOUNDARY_FENCES_1 = 22872,
    SPR_TERRAIN_BOUNDARY_FENCES_2 = 22873,
    SPR_TERRAIN_BOUNDARY_FENCES_3 = 22874,
    SPR_TERRAIN_BOUNDARY_FENCES_4 = 22875,
    SPR_TERRAIN_BOUNDARY_FENCES_5 = 22876,
    SPR_TERRAIN_BOUNDARY_FENCES_6 = 22877,

    SPR_TERRAIN_EDGE_MASK_TOP_RIGHT = 28883,
    SPR_TERRAIN_EDGE_MASK_BOTTOM_RIGHT = 28902,
    SPR_TERRAIN_EDGE_MASK_BOTTOM_LEFT = 28921,
    SPR_TERRAIN_EDGE_MASK_TOP_LEFT = 28940,
    SPR_TERRAIN_PATTERN_GRASS = 28959,
    SPR_TERRAIN_PATTERN_SAND = 28965,
    SPR_TERRAIN_PATTERN_SAND_RED = 28971,
    SPR_TERRAIN_PATTERN_DIRT = 28977,
    SPR_TERRAIN_PATTERN_SAND_YELLOW = 28983,
    SPR_TERRAIN_PATTERN_ROCK = 28989,
    SPR_TERRAIN_PATTERN_MARTIAN = 28995,
    SPR_TERRAIN_PATTERN_GRASS_CLUMPS = 29001,
    SPR_TERRAIN_PATTERN_ICE = 29007,

    SPR_RCT1_WATER_MASK = SPR_CSG_BEGIN + 46787,
    SPR_RCT1_WATER_OVERLAY = SPR_CSG_BEGIN + 46792,
};

std::optional<OpenRCT2::Drawing::Colour> GetPatrolAreaTileColour(const CoordsXY& pos);

void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, const OpenRCT2::SurfaceElement& tileElement);
