Welcome to mirror list, hosted at ThFree Co, Russian Federation.

design_collection_copy_state_enum.rb « design_management « types « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7e7303c50ef89029479a1173b3dfe82e54a01065 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# frozen_string_literal: true

module Types
  module DesignManagement
    class DesignCollectionCopyStateEnum < BaseEnum
      graphql_name 'DesignCollectionCopyState'
      description 'Copy state of a DesignCollection'

      DESCRIPTION_VARIANTS = {
        in_progress: 'is being copied',
        error: 'encountered an error during a copy',
        ready: 'has no copy in progress'
      }.freeze

      def self.description_variant(copy_state)
        DESCRIPTION_VARIANTS[copy_state.to_sym] ||
          (raise ArgumentError, "Unknown copy state: #{copy_state}")
      end

      ::DesignManagement::DesignCollection.state_machines[:copy_state].states.keys.each do |copy_state|
        value copy_state.upcase,
              value: copy_state.to_s,
              description: "The DesignCollection #{description_variant(copy_state)}"
      end
    end
  end
end