=begin
#Enterprise Mission Assurance Support Service (eMASS)

#The Enterprise Mission Assurance Support Service (eMASS) Representational State Transfer (REST) Application Programming Interface (API) enables users to perform assessments and complete actions associated with system records.   The `emasser` is a command-line interface (CLI) tool that implements all of the  eMASS endpoints defined in the eMASS REST API v3.2, dated October 21, 2021.</br><br>  <strong>Register CLI</strong></br> New users will need to register an API key with the eMASS development team prior to accessing the site for the first time. The eMASS REST API requires a client certificate (SSL/TLS, DoD PKI only) where {url}/api/register (POST) is used to register the client certificate.</br></br>  Every call to the eMASS REST API will require the use of the agreed upon public key certificate and API key. The API key must be provided in the request header for all endpoint calls (api-key). If the service receives an untrusted certificate or API key, a 401 error response code will be returned along with an error message.</br></br>  <strong>Available Request Headers:</strong></br> <table>   <tr>     <th align=left>key</th>     <th align=left>Example Value</th>     <th align=left>Description</th>   </tr>   <tr>     <td>`api-key`</td>     <td>api-key-provided-by-emass</td>     <td>This API key must be provided in the request header for all endpoint calls</td>   </tr>   <tr>     <td>`user-uid`</td>     <td>USER.UID.KEY</td>     <td>This User unique identifier key must be provided in the request header for all PUT, POST, and DELETE endpoint calls</td>   </tr>   <tr>     <td></td><td></td>     <td>       Note: For DoD users this is the DoD ID Number (EIDIPI) on their DoD CAC     </td>   </tr> </table>  </br><strong>Approve API Client for Actionable Requests</strong></br> Users are required to log-in to eMASS and grant permissions for a client to update data within eMASS on their behalf. This is only required for actionable requests (PUT, POST, DELETE). The Registration Endpoint and all GET requests can be accessed without completing this process with the correct permissions. Please note that leaving a field parameter blank (for PUT/POST requests) has the potential to clear information in the active eMASS records.  To establish an account with eMASS and/or acquire an api-key/user-uid, contact one of the listed POC: 

OpenAPI spec version: v3.2
Contact: disa.meade.id.mbx.emass-tier-iii-support@mail.mil
Generated by: https://github.com/swagger-api/swagger-codegen.git
Swagger Codegen version: 3.0.26
=end

module SwaggerClient
  class POAMApi
    attr_accessor :api_client

    def initialize(api_client = ApiClient.default)
      @api_client = api_client
    end
    # Add one or many POA&M items in a system
    # Add a POA&M for given `systemId`<br>  **Request Body Required Fields** - `status` - `vulnerabilityDescription` - `sourceIdentVuln` - `pocOrganization` - `resources`  **Note**<br /> If a POC email is supplied, the application will attempt to locate a user already registered within the application and pre-populate any information not explicitly supplied in the request. If no such user is found, these fields are **required** within the request.<br> `pocFirstName`, `pocLastName`, `pocPhoneNumber`<br />
    # @param body Update an existing control by Id
    # @param system_id **System Id**: The unique system record identifier.
    # @param [Hash] opts the optional parameters
    # @return [PoamResponsePost]
    def add_poam_by_system_id(body, system_id, opts = {})
      data, _status_code, _headers = add_poam_by_system_id_with_http_info(body, system_id, opts)
      data
    end

    # Add one or many POA&amp;M items in a system
    # Add a POA&amp;M for given &#x60;systemId&#x60;&lt;br&gt;  **Request Body Required Fields** - &#x60;status&#x60; - &#x60;vulnerabilityDescription&#x60; - &#x60;sourceIdentVuln&#x60; - &#x60;pocOrganization&#x60; - &#x60;resources&#x60;  **Note**&lt;br /&gt; If a POC email is supplied, the application will attempt to locate a user already registered within the application and pre-populate any information not explicitly supplied in the request. If no such user is found, these fields are **required** within the request.&lt;br&gt; &#x60;pocFirstName&#x60;, &#x60;pocLastName&#x60;, &#x60;pocPhoneNumber&#x60;&lt;br /&gt;
    # @param body Update an existing control by Id
    # @param system_id **System Id**: The unique system record identifier.
    # @param [Hash] opts the optional parameters
    # @return [Array<(PoamResponsePost, Integer, Hash)>] PoamResponsePost data, response status code and response headers
    def add_poam_by_system_id_with_http_info(body, system_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: POAMApi.add_poam_by_system_id ...'
      end
      # verify the required parameter 'body' is set
      if @api_client.config.client_side_validation && body.nil?
        fail ArgumentError, "Missing the required parameter 'body' when calling POAMApi.add_poam_by_system_id"
      end
      # verify the required parameter 'system_id' is set
      if @api_client.config.client_side_validation && system_id.nil?
        fail ArgumentError, "Missing the required parameter 'system_id' when calling POAMApi.add_poam_by_system_id"
      end
      # resource path
      local_var_path = '/api/systems/{systemId}/poams'.sub('{' + 'systemId' + '}', system_id.to_s)

      # query parameters
      query_params = opts[:query_params] || {}

      # header parameters
      header_params = opts[:header_params] || {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json'])
      # HTTP header 'Content-Type'
      header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:body] || @api_client.object_to_http_body(body) 

      return_type = opts[:return_type] || 'PoamResponsePost' 

      auth_names = opts[:auth_names] || ['apikey', 'mockType', 'userid']
      data, status_code, headers = @api_client.call_api(:POST, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => return_type)

      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: POAMApi#add_poam_by_system_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Remove one or many POA&M items in a system
    # Remove the POA&M matching `systemId` path parameter and `poamId` query parameter<br>
    # @param body Delete the given POA&amp;M Id
    # @param system_id **System Id**: The unique system record identifier.
    # @param [Hash] opts the optional parameters
    # @return [PoamResponseDelete]
    def delete_poam(body, system_id, opts = {})
      data, _status_code, _headers = delete_poam_with_http_info(body, system_id, opts)
      data
    end

    # Remove one or many POA&amp;M items in a system
    # Remove the POA&amp;M matching &#x60;systemId&#x60; path parameter and &#x60;poamId&#x60; query parameter&lt;br&gt;
    # @param body Delete the given POA&amp;M Id
    # @param system_id **System Id**: The unique system record identifier.
    # @param [Hash] opts the optional parameters
    # @return [Array<(PoamResponseDelete, Integer, Hash)>] PoamResponseDelete data, response status code and response headers
    def delete_poam_with_http_info(body, system_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: POAMApi.delete_poam ...'
      end
      # verify the required parameter 'body' is set
      if @api_client.config.client_side_validation && body.nil?
        fail ArgumentError, "Missing the required parameter 'body' when calling POAMApi.delete_poam"
      end
      # verify the required parameter 'system_id' is set
      if @api_client.config.client_side_validation && system_id.nil?
        fail ArgumentError, "Missing the required parameter 'system_id' when calling POAMApi.delete_poam"
      end
      # resource path
      local_var_path = '/api/systems/{systemId}/poams'.sub('{' + 'systemId' + '}', system_id.to_s)

      # query parameters
      query_params = opts[:query_params] || {}

      # header parameters
      header_params = opts[:header_params] || {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json'])
      # HTTP header 'Content-Type'
      header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:body] || @api_client.object_to_http_body(body) 

      return_type = opts[:return_type] || 'PoamResponseDelete' 

      auth_names = opts[:auth_names] || ['apikey', 'mockType', 'userid']
      data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => return_type)

      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: POAMApi#delete_poam\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Get one or many POA&M items in a system
    # Returns system(s) containing POA&M items for matching parameters.
    # @param system_id **System Id**: The unique system record identifier.
    # @param [Hash] opts the optional parameters
    # @option opts [String] :scheduled_completion_date_start **Date Started**: Filter query by the scheduled completion start date (Unix date format).
    # @option opts [String] :scheduled_completion_date_end **Date Ended**: Filter query by the scheduled completion start date (Unix date format).
    # @option opts [String] :control_acronyms **System Acronym**: Filter query by given system acronym (single or comma separated).
    # @option opts [String] :ccis **CCI System**: Filter query by Control Correlation Identifiers (CCIs).
    # @option opts [BOOLEAN] :system_only **Systems Only**: Indicates that only system(s) information is retrieved. (default to true)
    # @return [PoamResponseGet]
    def get_system_poams(system_id, opts = {})
      data, _status_code, _headers = get_system_poams_with_http_info(system_id, opts)
      data
    end

    # Get one or many POA&amp;M items in a system
    # Returns system(s) containing POA&amp;M items for matching parameters.
    # @param system_id **System Id**: The unique system record identifier.
    # @param [Hash] opts the optional parameters
    # @option opts [String] :scheduled_completion_date_start **Date Started**: Filter query by the scheduled completion start date (Unix date format).
    # @option opts [String] :scheduled_completion_date_end **Date Ended**: Filter query by the scheduled completion start date (Unix date format).
    # @option opts [String] :control_acronyms **System Acronym**: Filter query by given system acronym (single or comma separated).
    # @option opts [String] :ccis **CCI System**: Filter query by Control Correlation Identifiers (CCIs).
    # @option opts [BOOLEAN] :system_only **Systems Only**: Indicates that only system(s) information is retrieved.
    # @return [Array<(PoamResponseGet, Integer, Hash)>] PoamResponseGet data, response status code and response headers
    def get_system_poams_with_http_info(system_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: POAMApi.get_system_poams ...'
      end
      # verify the required parameter 'system_id' is set
      if @api_client.config.client_side_validation && system_id.nil?
        fail ArgumentError, "Missing the required parameter 'system_id' when calling POAMApi.get_system_poams"
      end
      # resource path
      local_var_path = '/api/systems/{systemId}/poams'.sub('{' + 'systemId' + '}', system_id.to_s)

      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'scheduledCompletionDateStart'] = opts[:'scheduled_completion_date_start'] if !opts[:'scheduled_completion_date_start'].nil?
      query_params[:'scheduledCompletionDateEnd'] = opts[:'scheduled_completion_date_end'] if !opts[:'scheduled_completion_date_end'].nil?
      query_params[:'controlAcronyms'] = opts[:'control_acronyms'] if !opts[:'control_acronyms'].nil?
      query_params[:'ccis'] = opts[:'ccis'] if !opts[:'ccis'].nil?
      query_params[:'systemOnly'] = opts[:'system_only'] if !opts[:'system_only'].nil?

      # header parameters
      header_params = opts[:header_params] || {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json'])

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:body] 

      return_type = opts[:return_type] || 'PoamResponseGet' 

      auth_names = opts[:auth_names] || ['apikey', 'mockType', 'userid']
      data, status_code, headers = @api_client.call_api(:GET, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => return_type)

      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: POAMApi#get_system_poams\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Get POA&M item by ID in a system
    # Returns system(s) containing POA&M items for matching parameters.
    # @param system_id **System Id**: The unique system record identifier.
    # @param poam_id **POA&amp;M Id**: The unique POA&amp;M record identifier.
    # @param [Hash] opts the optional parameters
    # @return [PoamResponseGet]
    def get_system_poams_by_poam_id(system_id, poam_id, opts = {})
      data, _status_code, _headers = get_system_poams_by_poam_id_with_http_info(system_id, poam_id, opts)
      data
    end

    # Get POA&amp;M item by ID in a system
    # Returns system(s) containing POA&amp;M items for matching parameters.
    # @param system_id **System Id**: The unique system record identifier.
    # @param poam_id **POA&amp;M Id**: The unique POA&amp;M record identifier.
    # @param [Hash] opts the optional parameters
    # @return [Array<(PoamResponseGet, Integer, Hash)>] PoamResponseGet data, response status code and response headers
    def get_system_poams_by_poam_id_with_http_info(system_id, poam_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: POAMApi.get_system_poams_by_poam_id ...'
      end
      # verify the required parameter 'system_id' is set
      if @api_client.config.client_side_validation && system_id.nil?
        fail ArgumentError, "Missing the required parameter 'system_id' when calling POAMApi.get_system_poams_by_poam_id"
      end
      # verify the required parameter 'poam_id' is set
      if @api_client.config.client_side_validation && poam_id.nil?
        fail ArgumentError, "Missing the required parameter 'poam_id' when calling POAMApi.get_system_poams_by_poam_id"
      end
      # resource path
      local_var_path = '/api/systems/{systemId}/poams/{poamId}'.sub('{' + 'systemId' + '}', system_id.to_s).sub('{' + 'poamId' + '}', poam_id.to_s)

      # query parameters
      query_params = opts[:query_params] || {}

      # header parameters
      header_params = opts[:header_params] || {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json'])

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:body] 

      return_type = opts[:return_type] || 'PoamResponseGet' 

      auth_names = opts[:auth_names] || ['apikey', 'mockType', 'userid']
      data, status_code, headers = @api_client.call_api(:GET, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => return_type)

      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: POAMApi#get_system_poams_by_poam_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
    # Update one or many POA&M items in a system
    # Update a POA&M for given `systemId`<br>  **Request Body Required Fields** - `poamId` - `displayPoamId` - `status` - `vulnerabilityDescription` - `sourceIdentVuln` - `pocOrganization` - `reviewStatus`  **Notes** - If a POC email is supplied, the application will attempt to locate a user already   registered within the application and pre-populate any information not explicitly supplied   in the request. If no such user is found, these fields are **required** within the request.<br>   `pocOrganization`, `pocFirstName`, `pocLastName`, `pocEmail`, `pocPhoneNumber`<br />  - To delete a milestone through the POA&M PUT the field `isActive` must be set to `false`: `isActive=false`.
    # @param body Update an existing control by Id
    # @param system_id **System Id**: The unique system record identifier.
    # @param [Hash] opts the optional parameters
    # @return [PoamResponsePut]
    def update_poam_by_system_id(body, system_id, opts = {})
      data, _status_code, _headers = update_poam_by_system_id_with_http_info(body, system_id, opts)
      data
    end

    # Update one or many POA&amp;M items in a system
    # Update a POA&amp;M for given &#x60;systemId&#x60;&lt;br&gt;  **Request Body Required Fields** - &#x60;poamId&#x60; - &#x60;displayPoamId&#x60; - &#x60;status&#x60; - &#x60;vulnerabilityDescription&#x60; - &#x60;sourceIdentVuln&#x60; - &#x60;pocOrganization&#x60; - &#x60;reviewStatus&#x60;  **Notes** - If a POC email is supplied, the application will attempt to locate a user already   registered within the application and pre-populate any information not explicitly supplied   in the request. If no such user is found, these fields are **required** within the request.&lt;br&gt;   &#x60;pocOrganization&#x60;, &#x60;pocFirstName&#x60;, &#x60;pocLastName&#x60;, &#x60;pocEmail&#x60;, &#x60;pocPhoneNumber&#x60;&lt;br /&gt;  - To delete a milestone through the POA&amp;M PUT the field &#x60;isActive&#x60; must be set to &#x60;false&#x60;: &#x60;isActive&#x3D;false&#x60;.
    # @param body Update an existing control by Id
    # @param system_id **System Id**: The unique system record identifier.
    # @param [Hash] opts the optional parameters
    # @return [Array<(PoamResponsePut, Integer, Hash)>] PoamResponsePut data, response status code and response headers
    def update_poam_by_system_id_with_http_info(body, system_id, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: POAMApi.update_poam_by_system_id ...'
      end
      # verify the required parameter 'body' is set
      if @api_client.config.client_side_validation && body.nil?
        fail ArgumentError, "Missing the required parameter 'body' when calling POAMApi.update_poam_by_system_id"
      end
      # verify the required parameter 'system_id' is set
      if @api_client.config.client_side_validation && system_id.nil?
        fail ArgumentError, "Missing the required parameter 'system_id' when calling POAMApi.update_poam_by_system_id"
      end
      # resource path
      local_var_path = '/api/systems/{systemId}/poams'.sub('{' + 'systemId' + '}', system_id.to_s)

      # query parameters
      query_params = opts[:query_params] || {}

      # header parameters
      header_params = opts[:header_params] || {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json'])
      # HTTP header 'Content-Type'
      header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:body] || @api_client.object_to_http_body(body) 

      return_type = opts[:return_type] || 'PoamResponsePut' 

      auth_names = opts[:auth_names] || ['apikey', 'mockType', 'userid']
      data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => return_type)

      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: POAMApi#update_poam_by_system_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
  end
end