Files
sam-api/app/Swagger/v1/ClientApi.php

186 lines
8.1 KiB
PHP
Raw Normal View History

<?php
namespace App\Swagger\v1;
/**
* @OA\Tag(name="Client", description="거래처 관리")
*
* @OA\Schema(
* schema="Client",
* type="object",
* required={"id","client_code","name"},
* @OA\Property(property="id", type="integer", example=1),
* @OA\Property(property="tenant_id", type="integer", example=1),
* @OA\Property(property="client_code", type="string", example="CLIENT_001"),
* @OA\Property(property="name", type="string", example="거래처명"),
* @OA\Property(property="contact_person", type="string", nullable=true, example="홍길동"),
* @OA\Property(property="phone", type="string", nullable=true, example="010-1234-5678"),
* @OA\Property(property="email", type="string", nullable=true, example="client@example.com"),
* @OA\Property(property="address", type="string", nullable=true, example="서울시 강남구"),
* @OA\Property(property="is_active", type="string", enum={"Y", "N"}, example="Y"),
* @OA\Property(property="created_at", type="string", example="2025-10-01 12:00:00"),
* @OA\Property(property="updated_at", type="string", example="2025-10-01 12:00:00")
* )
*
* @OA\Schema(
* schema="ClientPagination",
* type="object",
* @OA\Property(property="current_page", type="integer", example=1),
* @OA\Property(
* property="data",
* type="array",
* @OA\Items(ref="#/components/schemas/Client")
* ),
* @OA\Property(property="first_page_url", type="string", example="/api/v1/clients?page=1"),
* @OA\Property(property="from", type="integer", example=1),
* @OA\Property(property="last_page", type="integer", example=3),
* @OA\Property(property="last_page_url", type="string", example="/api/v1/clients?page=3"),
* @OA\Property(
* property="links",
* type="array",
* @OA\Items(type="object",
* @OA\Property(property="url", type="string", nullable=true, example=null),
* @OA\Property(property="label", type="string", example="&laquo; Previous"),
* @OA\Property(property="active", type="boolean", example=false)
* )
* ),
* @OA\Property(property="next_page_url", type="string", nullable=true, example="/api/v1/clients?page=2"),
* @OA\Property(property="path", type="string", example="/api/v1/clients"),
* @OA\Property(property="per_page", type="integer", example=20),
* @OA\Property(property="prev_page_url", type="string", nullable=true, example=null),
* @OA\Property(property="to", type="integer", example=20),
* @OA\Property(property="total", type="integer", example=50)
* )
*
* @OA\Schema(
* schema="ClientCreateRequest",
* type="object",
* required={"client_code","name"},
* @OA\Property(property="client_code", type="string", maxLength=50, example="CLIENT_001"),
* @OA\Property(property="name", type="string", maxLength=100, example="거래처명"),
* @OA\Property(property="contact_person", type="string", nullable=true, maxLength=100, example="홍길동"),
* @OA\Property(property="phone", type="string", nullable=true, maxLength=20, example="010-1234-5678"),
* @OA\Property(property="email", type="string", nullable=true, maxLength=100, example="client@example.com"),
* @OA\Property(property="address", type="string", nullable=true, maxLength=255, example="서울시 강남구"),
* @OA\Property(property="is_active", type="string", enum={"Y", "N"}, example="Y")
* )
*
* @OA\Schema(
* schema="ClientUpdateRequest",
* type="object",
* @OA\Property(property="client_code", type="string", maxLength=50),
* @OA\Property(property="name", type="string", maxLength=100),
* @OA\Property(property="contact_person", type="string", nullable=true, maxLength=100),
* @OA\Property(property="phone", type="string", nullable=true, maxLength=20),
* @OA\Property(property="email", type="string", nullable=true, maxLength=100),
* @OA\Property(property="address", type="string", nullable=true, maxLength=255),
* @OA\Property(property="is_active", type="string", enum={"Y", "N"})
* )
*/
class ClientApi
{
/**
* @OA\Get(
* path="/api/v1/clients",
* tags={"Client"},
* summary="거래처 목록",
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
* @OA\Parameter(name="page", in="query", @OA\Schema(type="integer", example=1)),
* @OA\Parameter(name="size", in="query", @OA\Schema(type="integer", example=20)),
* @OA\Parameter(name="q", in="query", description="거래처 코드/이름 검색", @OA\Schema(type="string")),
* @OA\Parameter(name="only_active", in="query", @OA\Schema(type="boolean")),
* @OA\Response(response=200, description="조회 성공",
* @OA\JsonContent(allOf={
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/ClientPagination"))
* })
* ),
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
* )
*/
public function index() {}
/**
* @OA\Get(
* path="/api/v1/clients/{id}",
* tags={"Client"},
* summary="거래처 단건 조회",
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
* @OA\Response(response=200, description="조회 성공",
* @OA\JsonContent(allOf={
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/Client"))
* })
* ),
* @OA\Response(response=404, description="데이터 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
* )
*/
public function show() {}
/**
* @OA\Post(
* path="/api/v1/clients",
* tags={"Client"},
* summary="거래처 생성",
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
* @OA\RequestBody(required=true, @OA\JsonContent(ref="#/components/schemas/ClientCreateRequest")),
* @OA\Response(response=200, description="생성 성공",
* @OA\JsonContent(allOf={
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/Client"))
* })
* ),
* @OA\Response(response=400, description="검증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
* )
*/
public function store() {}
/**
* @OA\Put(
* path="/api/v1/clients/{id}",
* tags={"Client"},
* summary="거래처 수정",
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
* @OA\RequestBody(required=true, @OA\JsonContent(ref="#/components/schemas/ClientUpdateRequest")),
* @OA\Response(response=200, description="수정 성공",
* @OA\JsonContent(allOf={
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/Client"))
* })
* )
* )
*/
public function update() {}
/**
* @OA\Delete(
* path="/api/v1/clients/{id}",
* tags={"Client"},
* summary="거래처 삭제(soft)",
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
* @OA\Response(response=200, description="삭제 성공", @OA\JsonContent(ref="#/components/schemas/ApiResponse"))
* )
*/
public function destroy() {}
/**
* @OA\Patch(
* path="/api/v1/clients/{id}/toggle",
* tags={"Client"},
* summary="활성/비활성 토글",
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
* @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
* @OA\Response(response=200, description="변경 성공",
* @OA\JsonContent(allOf={
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(@OA\Property(property="data", ref="#/components/schemas/Client"))
* })
* )
* )
*/
public function toggle() {}
}