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

314 lines
16 KiB
PHP
Raw Normal View History

<?php
namespace App\Swagger\v1;
/**
* @OA\Tag(name="Withdrawals", description="출금 관리")
*
* @OA\Schema(
* schema="Withdrawal",
* type="object",
* description="출금 정보",
*
* @OA\Property(property="id", type="integer", example=1, description="출금 ID"),
* @OA\Property(property="tenant_id", type="integer", example=1, description="테넌트 ID"),
* @OA\Property(property="withdrawal_date", type="string", format="date", example="2025-01-15", description="출금일"),
* @OA\Property(property="client_id", type="integer", example=1, nullable=true, description="거래처 ID"),
* @OA\Property(property="client_name", type="string", example="홍길동", nullable=true, description="비회원 거래처명"),
* @OA\Property(property="bank_account_id", type="integer", example=1, nullable=true, description="출금 계좌 ID"),
* @OA\Property(property="amount", type="number", format="float", example=500000, description="금액"),
* @OA\Property(property="payment_method", type="string", enum={"cash","transfer","card","check"}, example="transfer", description="결제수단"),
* @OA\Property(property="account_code", type="string", example="501", nullable=true, description="계정과목"),
* @OA\Property(property="description", type="string", example="사무용품 구매", nullable=true, description="적요"),
* @OA\Property(property="reference_type", type="string", example="purchase", nullable=true, description="참조 유형"),
* @OA\Property(property="reference_id", type="integer", example=1, nullable=true, description="참조 ID"),
* @OA\Property(property="client", type="object", nullable=true,
* @OA\Property(property="id", type="integer", example=1),
* @OA\Property(property="name", type="string", example="(주)테스트"),
* description="거래처 정보"
* ),
* @OA\Property(property="bank_account", type="object", nullable=true,
* @OA\Property(property="id", type="integer", example=1),
* @OA\Property(property="bank_name", type="string", example="국민은행"),
* @OA\Property(property="account_name", type="string", example="법인통장"),
* description="계좌 정보"
* ),
* @OA\Property(property="created_by", type="integer", example=1, nullable=true, description="생성자 ID"),
* @OA\Property(property="created_at", type="string", format="date-time"),
* @OA\Property(property="updated_at", type="string", format="date-time")
* )
*
* @OA\Schema(
* schema="WithdrawalCreateRequest",
* type="object",
* required={"withdrawal_date","amount","payment_method"},
* description="출금 등록 요청",
*
* @OA\Property(property="withdrawal_date", type="string", format="date", example="2025-01-15", description="출금일"),
* @OA\Property(property="client_id", type="integer", example=1, nullable=true, description="거래처 ID"),
* @OA\Property(property="client_name", type="string", example="홍길동", maxLength=100, nullable=true, description="비회원 거래처명"),
* @OA\Property(property="bank_account_id", type="integer", example=1, nullable=true, description="출금 계좌 ID"),
* @OA\Property(property="amount", type="number", format="float", example=500000, description="금액"),
* @OA\Property(property="payment_method", type="string", enum={"cash","transfer","card","check"}, example="transfer", description="결제수단"),
* @OA\Property(property="account_code", type="string", example="501", maxLength=20, nullable=true, description="계정과목"),
* @OA\Property(property="description", type="string", example="사무용품 구매", maxLength=1000, nullable=true, description="적요"),
* @OA\Property(property="reference_type", type="string", example="purchase", maxLength=50, nullable=true, description="참조 유형"),
* @OA\Property(property="reference_id", type="integer", example=1, nullable=true, description="참조 ID")
* )
*
* @OA\Schema(
* schema="WithdrawalUpdateRequest",
* type="object",
* description="출금 수정 요청",
*
* @OA\Property(property="withdrawal_date", type="string", format="date", example="2025-01-15", description="출금일"),
* @OA\Property(property="client_id", type="integer", example=1, nullable=true, description="거래처 ID"),
* @OA\Property(property="client_name", type="string", example="홍길동", maxLength=100, nullable=true, description="비회원 거래처명"),
* @OA\Property(property="bank_account_id", type="integer", example=1, nullable=true, description="출금 계좌 ID"),
* @OA\Property(property="amount", type="number", format="float", example=500000, description="금액"),
* @OA\Property(property="payment_method", type="string", enum={"cash","transfer","card","check"}, example="transfer", description="결제수단"),
* @OA\Property(property="account_code", type="string", example="501", maxLength=20, nullable=true, description="계정과목"),
* @OA\Property(property="description", type="string", example="사무용품 구매", maxLength=1000, nullable=true, description="적요"),
* @OA\Property(property="reference_type", type="string", example="purchase", maxLength=50, nullable=true, description="참조 유형"),
* @OA\Property(property="reference_id", type="integer", example=1, nullable=true, description="참조 ID")
* )
*
* @OA\Schema(
* schema="WithdrawalSummary",
* type="object",
* description="출금 요약",
*
* @OA\Property(property="total_amount", type="number", format="float", example=3000000, description="총 출금액"),
* @OA\Property(property="total_count", type="integer", example=15, description="총 건수"),
* @OA\Property(property="by_payment_method", type="object", description="결제수단별 합계",
* @OA\Property(property="cash", type="object",
* @OA\Property(property="total", type="number", example=500000),
* @OA\Property(property="count", type="integer", example=5)
* ),
* @OA\Property(property="transfer", type="object",
* @OA\Property(property="total", type="number", example=2500000),
* @OA\Property(property="count", type="integer", example=10)
* )
* )
* )
*/
class WithdrawalApi
{
/**
* @OA\Get(
* path="/api/v1/withdrawals",
* tags={"Withdrawals"},
* summary="출금 목록 조회",
* description="출금 목록을 조회합니다.",
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
*
* @OA\Parameter(name="search", in="query", description="검색어 (거래처명, 적요)", @OA\Schema(type="string")),
* @OA\Parameter(name="start_date", in="query", description="시작일", @OA\Schema(type="string", format="date")),
* @OA\Parameter(name="end_date", in="query", description="종료일", @OA\Schema(type="string", format="date")),
* @OA\Parameter(name="client_id", in="query", description="거래처 ID", @OA\Schema(type="integer")),
* @OA\Parameter(name="payment_method", in="query", description="결제수단", @OA\Schema(type="string", enum={"cash","transfer","card","check"})),
* @OA\Parameter(name="bank_account_id", in="query", description="계좌 ID", @OA\Schema(type="integer")),
* @OA\Parameter(name="sort_by", in="query", description="정렬 기준", @OA\Schema(type="string", enum={"withdrawal_date","amount","created_at"}, default="withdrawal_date")),
* @OA\Parameter(name="sort_dir", in="query", description="정렬 방향", @OA\Schema(type="string", enum={"asc","desc"}, default="desc")),
* @OA\Parameter(ref="#/components/parameters/Page"),
* @OA\Parameter(ref="#/components/parameters/Size"),
*
* @OA\Response(
* response=200,
* description="조회 성공",
*
* @OA\JsonContent(
* allOf={
*
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(
*
* @OA\Property(
* property="data",
* type="object",
* @OA\Property(property="current_page", type="integer", example=1),
* @OA\Property(property="data", type="array", @OA\Items(ref="#/components/schemas/Withdrawal")),
* @OA\Property(property="per_page", type="integer", example=20),
* @OA\Property(property="total", type="integer", example=30)
* )
* )
* }
* )
* ),
*
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
* )
*/
public function index() {}
/**
* @OA\Post(
* path="/api/v1/withdrawals",
* tags={"Withdrawals"},
* summary="출금 등록",
* description="새로운 출금을 등록합니다.",
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
*
* @OA\RequestBody(
* required=true,
*
* @OA\JsonContent(ref="#/components/schemas/WithdrawalCreateRequest")
* ),
*
* @OA\Response(
* response=201,
* description="등록 성공",
*
* @OA\JsonContent(
* allOf={
*
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(
*
* @OA\Property(property="data", ref="#/components/schemas/Withdrawal")
* )
* }
* )
* ),
*
* @OA\Response(response=400, description="잘못된 요청", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
* )
*/
public function store() {}
/**
* @OA\Get(
* path="/api/v1/withdrawals/summary",
* tags={"Withdrawals"},
* summary="출금 요약 조회",
* description="기간별 출금 요약을 조회합니다.",
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
*
* @OA\Parameter(name="start_date", in="query", description="시작일", @OA\Schema(type="string", format="date")),
* @OA\Parameter(name="end_date", in="query", description="종료일", @OA\Schema(type="string", format="date")),
* @OA\Parameter(name="client_id", in="query", description="거래처 ID", @OA\Schema(type="integer")),
* @OA\Parameter(name="payment_method", in="query", description="결제수단", @OA\Schema(type="string", enum={"cash","transfer","card","check"})),
*
* @OA\Response(
* response=200,
* description="조회 성공",
*
* @OA\JsonContent(
* allOf={
*
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(
*
* @OA\Property(property="data", ref="#/components/schemas/WithdrawalSummary")
* )
* }
* )
* ),
*
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
* )
*/
public function summary() {}
/**
* @OA\Get(
* path="/api/v1/withdrawals/{id}",
* tags={"Withdrawals"},
* summary="출금 상세 조회",
* description="출금 상세 정보를 조회합니다.",
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
*
* @OA\Parameter(name="id", in="path", required=true, description="출금 ID", @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/Withdrawal")
* )
* }
* )
* ),
*
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
* @OA\Response(response=404, description="출금 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
* )
*/
public function show() {}
/**
* @OA\Put(
* path="/api/v1/withdrawals/{id}",
* tags={"Withdrawals"},
* summary="출금 수정",
* description="출금 정보를 수정합니다.",
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
*
* @OA\Parameter(name="id", in="path", required=true, description="출금 ID", @OA\Schema(type="integer")),
*
* @OA\RequestBody(
* required=true,
*
* @OA\JsonContent(ref="#/components/schemas/WithdrawalUpdateRequest")
* ),
*
* @OA\Response(
* response=200,
* description="수정 성공",
*
* @OA\JsonContent(
* allOf={
*
* @OA\Schema(ref="#/components/schemas/ApiResponse"),
* @OA\Schema(
*
* @OA\Property(property="data", ref="#/components/schemas/Withdrawal")
* )
* }
* )
* ),
*
* @OA\Response(response=400, description="잘못된 요청", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
* @OA\Response(response=404, description="출금 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
* )
*/
public function update() {}
/**
* @OA\Delete(
* path="/api/v1/withdrawals/{id}",
* tags={"Withdrawals"},
* summary="출금 삭제",
* description="출금을 삭제합니다. (Soft Delete)",
* security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
*
* @OA\Parameter(name="id", in="path", required=true, description="출금 ID", @OA\Schema(type="integer")),
*
* @OA\Response(
* response=200,
* description="삭제 성공",
*
* @OA\JsonContent(ref="#/components/schemas/ApiResponse")
* ),
*
* @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
* @OA\Response(response=404, description="출금 없음", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
* @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
* )
*/
public function destroy() {}
}