[http(url: "https://oaprotection.org/api/v1")]
[csharp(namespace: OapApi.v1)]
service OapApiV1
{
	/// Gets applications for the current user.
	[http(method: GET, path: "/applications")]
	[tag(name:"bob")]
	method getApplications
	{
        /// Filter applications by the given status.
        status: ApplicationStatus;

		/// The limit of returned results.
		limit: int32;

        /// The token presenting the next page of applications to get.
        nextToken: string;
	}:
	{
		/// The applications.
		applications: Application[];

		/// The total number of applications.
		total: int64;

        /// The token representing the next page of results.
        nextToken: string;

        /// True if this is the last page of results, false otherwise.
        isLastPage: boolean;
	}

	/// Creates a new application for the current user.
	[http(method: POST, path: "/applications/", code: 201)]
	method createApplication
	{
		/// The application to create.
		[http(from: body)]
		applicationCreateSet: ApplicationCreateSet;
	}:
	{
		/// The created application.
		[http(from: body)]
		application: Application;
	}

	/// Gets the specified application for the current user.
	[http(method: GET, path: "/applications/{id}")]
	method getApplication
	{
		/// The widget ID.
		id: string;
	}:
	{
		/// The requested widget.
		[http(from: body)]
		application: Application;

		[http(from: header)]
		eTag: string;

		[http(from: body, code: 304)]
		notModified: boolean;
	}

	/// Updates the application.
	[http(method: PATCH, path: "/applications/{id}")]
	method updateApplication
	{
		/// The application ID.
		id: string;

        /// The application update set.
		[http(from: body)]
        applicationChangeSet: ApplicationChangeSet;
	}:
	{
		/// The updated Application.
		[http(from: body, code: 200)]
		application: Application;
	}

	/// An application.
	data Application
	{
		/// A unique identifier for the application.
		id: string;

        /// The current status of this application.
        status: ApplicationStatus;

        /// Terms the user must accept to start, continue an accept an application.
        terms: ApplicationTerms;
	}

    data ApplicationCreateSet
    {
        /// Terms a user must accept to start an application.
        terms: ApplicationTermsCreateSet!;
    }

    data ApplicationChangeSet
    {
    }

    data ApplicationTermsCreateSet
    {
        hasReadInstructions: boolean!;
    }

    data ApplicationTerms
    {
        hasReadInstructions: boolean;
    }

    enum ApplicationStatus
    {
        InProgress,
        Submitted
    }
}

# OapApiV1

API providing OAP functionality for the application form, calculator and more.

## Heading

Use a primary heading to indicate the member name.

# getApplications

Gets the current user's applications in pages.

# createApplication

Creates a new application for the current user.

# updateApplication

Updates an application for the current user, given the ID of the application to update.

# Application

Represents a user's application, whether in progress or submitted.


