require "bigdecimal/util"

module DataModel
	# test fixtures for BigDecimal
	module Fixtures::BigDecimal
		include Fixtures
		extend self

		# a simple decimal example
		# @return [Example] the example
		def simple
			Example.new(
				[:decimal],
				variants: {
					valid: 5.to_d,
					missing: nil,
					string: ["5", 5.to_d]
				},
			)
		end

		# a decimal example that is optional
		# @return [Example] the example
		def optional
			Example.new(
				[:decimal, { optional: true }],
				variants: {
					missing: nil
				},
			)
		end

		# a decimal example that has a restriction on the minimum value
		# @return [Example] the example
		def min
			Example.new(
				[:decimal, { min: 5 }],
				variants: {
					bigger: 6.to_d,
					smaller: 4.to_d
				},
			)
		end

		# a decimal example that has a restriction on the maximum value
		# @return [Example] the example
		def max
			Example.new(
				[:decimal, { max: 5 }],
				variants: {
					bigger: 6.to_d,
					smaller: 4.to_d
				},
			)
		end
	end
end