> ## Documentation Index
> Fetch the complete documentation index at: https://api-docs.vpms.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Core Service API

> VPMS Core 서비스 API 레퍼런스

## 개요

Core Service는 VPMS(Vendit Property Management System) 클러스터의 핵심 서비스로, 숙박 시설 관리를 위한 주요 비즈니스 로직을 제공합니다.

## 주요 기능

### 예약 관리

* 예약 생성, 수정, 취소
* 객실 배정 및 관리
* 체크인/체크아웃 처리

### 인증 및 보안

* SMS 기반 인증
* 세션 관리
* 접근 제어

### 요금 및 재고 관리 (ARI)

* 객실 요금 설정
* 재고 관리
* 패키지 및 서비스 관리

### 결제 및 정산

* Folio 관리
* 청구서 생성
* 마일리지 시스템

## API 도메인

<CardGroup cols={2}>
  <Card title="인증 (Auth)" icon="key" href="/api-reference/core-svc/auth">
    SMS 기반 인증 시스템
  </Card>

  <Card title="예약 (Reservation)" icon="calendar" href="/api-reference/core-svc/reservation">
    예약 생성 및 관리
  </Card>

  <Card title="객실 (Room)" icon="bed" href="/api-reference/core-svc/room">
    객실 및 객실 타입 관리
  </Card>

  <Card title="재고 (Inventory)" icon="boxes" href="/api-reference/core-svc/inventory">
    객실 재고 관리
  </Card>

  <Card title="요금 (ARI Rate)" icon="money-bill" href="/api-reference/core-svc/ari-rate">
    객실 요금 설정
  </Card>

  <Card title="마일리지 (Mileage)" icon="award" href="/api-reference/core-svc/mileage">
    마일리지 적립 및 사용
  </Card>
</CardGroup>

## 기술 스택

* **API 타입**: GraphQL (Apollo Federation)
* **프레임워크**: Fastify + TypeScript
* **데이터베이스**: PostgreSQL + Prisma ORM
* **인증**: JWT 기반
* **이벤트**: Event Sourcing

## GraphQL Endpoint

```
POST https://development.vpms.io/graphql
```

<Info>
  GraphQL 공통 설정 및 인증 방법은 [GraphQL 설정 가이드](/api-reference/introduction)를 참고하세요.
</Info>

## 시작하기

Core Service API를 사용하려면 먼저 인증 토큰이 필요합니다.

<Steps>
  <Step title="SMS 인증 요청">
    [requestMileageSMSAuth](/api-reference/core-svc/auth#requestmileagesmsauth)를 호출하여 인증번호 발송
  </Step>

  <Step title="인증 확인">
    [confirmMileageSMSAuth](/api-reference/core-svc/auth#confirmmileagesmsauth)로 인증 토큰 획득
  </Step>

  <Step title="API 호출">
    발급받은 토큰으로 다른 API 엔드포인트 호출
  </Step>
</Steps>

## 예제 코드

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { ApolloClient, InMemoryCache, gql } from '@apollo/client';

  const client = new ApolloClient({
    uri: 'https://development.vpms.io/graphql',
    cache: new InMemoryCache(),
    headers: {
      authorization: `Bearer ${YOUR_TOKEN}`,
    },
  });

  const GET_RESERVATIONS = gql`
    query GetReservations($accommodationId: ID!) {
      getReservations(accommodationId: $accommodationId) {
        id
        status
        guestName
      }
    }
  `;

  const { data } = await client.query({
    query: GET_RESERVATIONS,
    variables: { accommodationId: '01HQKS9V8X' },
  });
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://development.vpms.io/graphql', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${YOUR_TOKEN}`,
    },
    body: JSON.stringify({
      query: `
        query GetReservations($accommodationId: ID!) {
          getReservations(accommodationId: $accommodationId) {
            id
            status
            guestName
          }
        }
      `,
      variables: {
        accommodationId: '01HQKS9V8X'
      }
    })
  });

  const { data } = await response.json();
  ```
</CodeGroup>

## 관련 서비스

* [Booking Service](/api-reference/booking-svc/introduction) - 공개 구매 및 결제
* [User Service](/api-reference/user-svc/introduction) - 사용자 관리
* [Subscription Service](/api-reference/subscription-svc/introduction) - 구독 및 알림

## 지원

문의사항이 있으시면 [support@vendit.io](mailto:support@vendit.io)로 연락주세요.
