module JiraBox
  module Fields
    class Textarea < Base

      attr_accessor :custom_id, :body

      validates :custom_id, :body, presence: true
      validates :body, length: { minimum: 1 }

      def set(text)
        self.body = text
      end

      def to_hash
        { key => body }
      end

      def to_input_hash
        {
          display_name: display_name,
          type: :textarea,
          key: key,
          required: is_required
        }
      end

    end
  end # Fields
end # JiraBox
