/**
 * Paypal Server SDKLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */

import { object, optional, Schema, string } from '../schema';
import { LinkHTTPMethod, linkHTTPMethodSchema } from './linkHTTPMethod';

/** The request-related [HATEOAS link](/api/rest/responses/#hateoas-links) information. */
export interface LinkDescription {
  /** The complete target URL. To make the related call, combine the method with this [URI Template-formatted](https://tools.ietf.org/html/rfc6570) link. For pre-processing, include the `$`, `(`, and `)` characters. The `href` is the key HATEOAS component that links a completed call with a subsequent call. */
  href: string;
  /** The [link relation type](https://tools.ietf.org/html/rfc5988#section-4), which serves as an ID for a link that unambiguously describes the semantics of the link. See [Link Relations](https://www.iana.org/assignments/link-relations/link-relations.xhtml). */
  rel: string;
  /** The HTTP method required to make the related call. */
  method?: LinkHTTPMethod;
}

export const linkDescriptionSchema: Schema<LinkDescription> = object({
  href: ['href', string()],
  rel: ['rel', string()],
  method: ['method', optional(linkHTTPMethodSchema)],
});
