<?php

namespace App\Swagger\v1;

/**
 * @OA\Tag(name="Stocks", description="재고 현황")
 *
 * @OA\Schema(
 *     schema="Stock",
 *     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="item_code", type="string", example="ITEM-001", description="품목코드"),
 *     @OA\Property(property="item_name", type="string", example="원재료 A", description="품목명"),
 *     @OA\Property(property="item_type", type="string", enum={"raw_material","bent_part","purchased_part","sub_material","consumable"}, example="raw_material", description="품목유형"),
 *     @OA\Property(property="item_type_label", type="string", example="원자재", description="품목유형 라벨"),
 *     @OA\Property(property="specification", type="string", example="100x100mm", nullable=true, description="규격"),
 *     @OA\Property(property="unit", type="string", example="EA", description="단위"),
 *     @OA\Property(property="stock_qty", type="number", format="float", example=150.5, description="현재 재고량"),
 *     @OA\Property(property="safety_stock", type="number", format="float", example=50.0, description="안전 재고"),
 *     @OA\Property(property="reserved_qty", type="number", format="float", example=20.0, description="예약 수량"),
 *     @OA\Property(property="available_qty", type="number", format="float", example=130.5, description="가용 수량"),
 *     @OA\Property(property="lot_count", type="integer", example=3, description="LOT 개수"),
 *     @OA\Property(property="oldest_lot_date", type="string", format="date", example="2025-11-15", nullable=true, description="가장 오래된 LOT 입고일"),
 *     @OA\Property(property="days_elapsed", type="integer", example=41, description="경과일 (가장 오래된 LOT 기준)"),
 *     @OA\Property(property="location", type="string", example="A-01-01", nullable=true, description="위치"),
 *     @OA\Property(property="status", type="string", enum={"normal","low","out"}, example="normal", description="상태"),
 *     @OA\Property(property="status_label", type="string", example="정상", description="상태 라벨"),
 *     @OA\Property(property="last_receipt_date", type="string", format="date", example="2025-12-20", nullable=true, description="마지막 입고일"),
 *     @OA\Property(property="last_issue_date", type="string", format="date", example="2025-12-24", nullable=true, description="마지막 출고일"),
 *     @OA\Property(property="created_at", type="string", format="date-time"),
 *     @OA\Property(property="updated_at", type="string", format="date-time")
 * )
 *
 * @OA\Schema(
 *     schema="StockLot",
 *     type="object",
 *     description="재고 LOT 정보",
 *
 *     @OA\Property(property="id", type="integer", example=1, description="LOT ID"),
 *     @OA\Property(property="stock_id", type="integer", example=1, description="재고 ID"),
 *     @OA\Property(property="lot_no", type="string", example="251226-01", description="LOT번호"),
 *     @OA\Property(property="fifo_order", type="integer", example=1, description="FIFO 순서"),
 *     @OA\Property(property="receipt_date", type="string", format="date", example="2025-12-26", description="입고일"),
 *     @OA\Property(property="qty", type="number", format="float", example=50.0, description="수량"),
 *     @OA\Property(property="reserved_qty", type="number", format="float", example=10.0, description="예약 수량"),
 *     @OA\Property(property="available_qty", type="number", format="float", example=40.0, description="가용 수량"),
 *     @OA\Property(property="unit", type="string", example="EA", nullable=true, description="단위"),
 *     @OA\Property(property="supplier", type="string", example="(주)공급사", nullable=true, description="공급업체"),
 *     @OA\Property(property="supplier_lot", type="string", example="SUP-LOT-001", nullable=true, description="공급업체 LOT"),
 *     @OA\Property(property="po_number", type="string", example="PO-2025-001", nullable=true, description="발주번호"),
 *     @OA\Property(property="location", type="string", example="A-01-01", nullable=true, description="위치"),
 *     @OA\Property(property="status", type="string", enum={"available","reserved","used"}, example="available", description="상태"),
 *     @OA\Property(property="status_label", type="string", example="사용가능", description="상태 라벨"),
 *     @OA\Property(property="days_elapsed", type="integer", example=1, description="경과일"),
 *     @OA\Property(property="created_at", type="string", format="date-time"),
 *     @OA\Property(property="updated_at", type="string", format="date-time")
 * )
 *
 * @OA\Schema(
 *     schema="StockWithLots",
 *     type="object",
 *     description="재고 상세 정보 (LOT 포함)",
 *     allOf={
 *         @OA\Schema(ref="#/components/schemas/Stock"),
 *         @OA\Schema(
 *
 *             @OA\Property(
 *                 property="lots",
 *                 type="array",
 *                 description="LOT 목록 (FIFO 순서)",
 *
 *                 @OA\Items(ref="#/components/schemas/StockLot")
 *             )
 *         )
 *     }
 * )
 *
 * @OA\Schema(
 *     schema="StockStats",
 *     type="object",
 *     description="재고 통계",
 *
 *     @OA\Property(property="total_items", type="integer", example=150, description="전체 품목 수"),
 *     @OA\Property(property="normal_count", type="integer", example=120, description="정상 재고 품목 수"),
 *     @OA\Property(property="low_count", type="integer", example=20, description="부족 재고 품목 수"),
 *     @OA\Property(property="out_count", type="integer", example=10, description="재고 없음 품목 수")
 * )
 *
 * @OA\Schema(
 *     schema="StockStatsByItemType",
 *     type="object",
 *     description="품목유형별 재고 통계",
 *
 *     @OA\Property(
 *         property="raw_material",
 *         type="object",
 *         @OA\Property(property="label", type="string", example="원자재"),
 *         @OA\Property(property="count", type="integer", example=50),
 *         @OA\Property(property="total_qty", type="number", format="float", example=5000.0)
 *     ),
 *     @OA\Property(
 *         property="bent_part",
 *         type="object",
 *         @OA\Property(property="label", type="string", example="절곡부품"),
 *         @OA\Property(property="count", type="integer", example=30),
 *         @OA\Property(property="total_qty", type="number", format="float", example=2500.0)
 *     ),
 *     @OA\Property(
 *         property="purchased_part",
 *         type="object",
 *         @OA\Property(property="label", type="string", example="구매부품"),
 *         @OA\Property(property="count", type="integer", example=40),
 *         @OA\Property(property="total_qty", type="number", format="float", example=3000.0)
 *     ),
 *     @OA\Property(
 *         property="sub_material",
 *         type="object",
 *         @OA\Property(property="label", type="string", example="부자재"),
 *         @OA\Property(property="count", type="integer", example=20),
 *         @OA\Property(property="total_qty", type="number", format="float", example=1500.0)
 *     ),
 *     @OA\Property(
 *         property="consumable",
 *         type="object",
 *         @OA\Property(property="label", type="string", example="소모품"),
 *         @OA\Property(property="count", type="integer", example=10),
 *         @OA\Property(property="total_qty", type="number", format="float", example=500.0)
 *     )
 * )
 */
class StockApi
{
    /**
     * @OA\Get(
     *     path="/api/v1/stocks",
     *     tags={"Stocks"},
     *     summary="재고 목록 조회",
     *     description="재고 현황 목록을 조회합니다.",
     *     security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
     *
     *     @OA\Parameter(name="search", in="query", description="검색어 (품목코드, 품목명)", @OA\Schema(type="string")),
     *     @OA\Parameter(name="item_type", in="query", description="품목유형", @OA\Schema(type="string", enum={"raw_material","bent_part","purchased_part","sub_material","consumable"})),
     *     @OA\Parameter(name="status", in="query", description="재고상태", @OA\Schema(type="string", enum={"normal","low","out"})),
     *     @OA\Parameter(name="location", in="query", description="위치 (부분 일치)", @OA\Schema(type="string")),
     *     @OA\Parameter(name="sort_by", in="query", description="정렬 기준", @OA\Schema(type="string", enum={"item_code","item_name","stock_qty","oldest_lot_date"}, default="item_code")),
     *     @OA\Parameter(name="sort_dir", in="query", description="정렬 방향", @OA\Schema(type="string", enum={"asc","desc"}, default="asc")),
     *     @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/Stock")),
     *                         @OA\Property(property="per_page", type="integer", example=20),
     *                         @OA\Property(property="total", type="integer", example=150)
     *                     )
     *                 )
     *             }
     *         )
     *     ),
     *
     *     @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\Get(
     *     path="/api/v1/stocks/stats",
     *     tags={"Stocks"},
     *     summary="재고 통계 조회",
     *     description="전체 재고 현황 통계를 조회합니다.",
     *     security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
     *
     *     @OA\Response(
     *         response=200,
     *         description="조회 성공",
     *
     *         @OA\JsonContent(
     *             allOf={
     *
     *                 @OA\Schema(ref="#/components/schemas/ApiResponse"),
     *                 @OA\Schema(
     *
     *                     @OA\Property(property="data", ref="#/components/schemas/StockStats")
     *                 )
     *             }
     *         )
     *     ),
     *
     *     @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
     *     @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
     * )
     */
    public function stats() {}

    /**
     * @OA\Get(
     *     path="/api/v1/stocks/stats-by-type",
     *     tags={"Stocks"},
     *     summary="품목유형별 재고 통계 조회",
     *     description="품목유형별 재고 현황 통계를 조회합니다.",
     *     security={{"ApiKeyAuth":{}},{"BearerAuth":{}}},
     *
     *     @OA\Response(
     *         response=200,
     *         description="조회 성공",
     *
     *         @OA\JsonContent(
     *             allOf={
     *
     *                 @OA\Schema(ref="#/components/schemas/ApiResponse"),
     *                 @OA\Schema(
     *
     *                     @OA\Property(property="data", ref="#/components/schemas/StockStatsByItemType")
     *                 )
     *             }
     *         )
     *     ),
     *
     *     @OA\Response(response=401, description="인증 실패", @OA\JsonContent(ref="#/components/schemas/ErrorResponse")),
     *     @OA\Response(response=500, description="서버 에러", @OA\JsonContent(ref="#/components/schemas/ErrorResponse"))
     * )
     */
    public function statsByItemType() {}

    /**
     * @OA\Get(
     *     path="/api/v1/stocks/{id}",
     *     tags={"Stocks"},
     *     summary="재고 상세 조회",
     *     description="재고 상세 정보를 조회합니다. LOT 목록이 FIFO 순서로 포함됩니다.",
     *     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/StockWithLots")
     *                 )
     *             }
     *         )
     *     ),
     *
     *     @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() {}
}
