# frozen_string_literal: false
# Core SVG data for the flag fields.
#
# This class should never need to be called directly.
# @private
class USPSFlags::Core::Field
def initialize(style: :regular, color: :white, fly: USPSFlags::Config::BASE_FLY)
@style = style
@fly = fly
case color
when :white
border = true
@color_code = '#FFFFFF'
@past_mid_color = USPSFlags::Config::BLUE
@past_tail_color = USPSFlags::Config::RED
when :red
border = false
@color_code = USPSFlags::Config::RED
@past_mid_color = '#FFFFFF'
@past_tail_color = USPSFlags::Config::BLUE
when :blue
border = false
@color_code = USPSFlags::Config::BLUE
@past_mid_color = '#FFFFFF'
@past_tail_color = USPSFlags::Config::RED
end
@border_svg = border ? "stroke=\"#000000\" stroke-width=\"#{USPSFlags::Config::BASE_FLY / 600}\" " : ''
@hoist = (@fly * 2) / 3
end
def svg
case @style
when :regular
regular_field
when :swallowtail
swallowtail_field
when :past
past_field
end
end
private
def regular_field
<<~SVG
SVG
end
def swallowtail_field
<<~SVG
SVG
end
def past_field
<<~SVG
SVG
end
end