# ----------------------------------------------------------------------------
#                         TABLE DESCRIPTION
# ----------------------------------------------------------------------------
name: scenass_cost_generation_technologies
title: Investment cost of generation technologies
description: >
  Investment cost data for electricity generation technologies by technology, variant and year. Used as assumptions for scenario runs.
contract_type: ValueVariable

# ----------------------------------------------------------------------------
#                ----- Frictionless Table Schema -----
# ----------------------------------------------------------------------------
tableschema:

  # ----------------------------------------------------------------------------
  #                SEMANTIC FIELD DESCRIPTION
  # ----------------------------------------------------------------------------
  fieldDescriptors:
    - field: value
      type: value
    - field: year
      type: time
      frequency: yearly

  # ----------------------------------------------------------------------------
  #                        FOREIGN KEY CONSTRAINTS
  # ----------------------------------------------------------------------------
  # A list of field names that are jointly unique. As it is an assumption table,
  # it include the scenario information. E.g.
  primaryKey:
    [scenario_group, scenario_name, scenario_variant, technology, year, size]

  foreignKeys:
    - fields: technology
      reference:
        resource: dim_tech_generation
        fields: id
    - fields: [scenario_group, scenario_name, scenario_variant]
      reference:
        resource: dim_scenario
        fields: [group, name, variant]

  # ----------------------------------------------------------------------------
  #                  FRICTIONLESS FIELDS/COLUMNS
  # ----------------------------------------------------------------------------
  fields:
    - name: scenario_group
      type: string
      title: Scenario Group
      description: Scenario group

    - name: scenario_name
      type: string
      title: Scenario Name
      description: Scenario name

    - name: scenario_variant
      type: string
      title: Scenario Variant
      description: Scenario variant

    # enter the fields of the table (left year and country_id as example)
    - name: technology
      type: string
      title: Generation Technology
      description: Electricity generation technology
      constraints:
        required: true

    - name: size
      type: string
      title: Size
      description: Size of installed capacity

    - name: unit
      type: string
      title: Unit
      description: Measurement unit of the reported value
      constraints:
        required: true
        maxLength: 16

    - name: year
      type: integer
      title: Year
      description: Year to which the data value applies
      constraints:
        required: true
        minimum: 1900
        maximum: 2100

    - name: value
      type: number
      title: Value
      description: Generation technology investment cost in the specified unit for the given scenario, scenario variant, technology, size, and year
      constraints:
        required: true
        minimum: 0
