<?php

namespace App\Swagger\v1;

/**
 * @OA\Tag(
 *     name="Process",
 *     description="공정 관리"
 * )
 */

/**
 * @OA\Schema(
 *     schema="ProcessItem",
 *     type="object",
 *
 *     @OA\Property(property="id", type="integer", example=1),
 *     @OA\Property(property="process_id", type="integer", example=1),
 *     @OA\Property(property="item_id", type="integer", example=123),
 *     @OA\Property(property="priority", type="integer", example=0),
 *     @OA\Property(property="is_active", type="boolean", example=true),
 *     @OA\Property(property="item", type="object",
 *         @OA\Property(property="id", type="integer", example=123),
 *         @OA\Property(property="code", type="string", example="ITEM-001"),
 *         @OA\Property(property="name", type="string", example="품목명")
 *     )
 * )
 *
 * @OA\Schema(
 *     schema="ProcessClassificationRule",
 *     type="object",
 *
 *     @OA\Property(property="id", type="integer", example=1),
 *     @OA\Property(property="process_id", type="integer", example=1),
 *     @OA\Property(property="registration_type", type="string", example="pattern"),
 *     @OA\Property(property="rule_type", type="string", enum={"품목코드", "품목명", "품목구분"}),
 *     @OA\Property(property="matching_type", type="string", enum={"startsWith", "endsWith", "contains", "equals"}),
 *     @OA\Property(property="condition_value", type="string", example="SCR-"),
 *     @OA\Property(property="priority", type="integer", example=0),
 *     @OA\Property(property="description", type="string", nullable=true),
 *     @OA\Property(property="is_active", type="boolean", example=true)
 * )
 *
 * @OA\Schema(
 *     schema="Process",
 *     type="object",
 *
 *     @OA\Property(property="id", type="integer", example=1),
 *     @OA\Property(property="tenant_id", type="integer", example=1),
 *     @OA\Property(property="process_code", type="string", example="P-001"),
 *     @OA\Property(property="process_name", type="string", example="스크린 생산"),
 *     @OA\Property(property="description", type="string", nullable=true),
 *     @OA\Property(property="process_type", type="string", enum={"생산", "검사", "포장", "조립"}),
 *     @OA\Property(property="department", type="string", nullable=true),
 *     @OA\Property(property="work_log_template", type="string", nullable=true),
 *     @OA\Property(property="required_workers", type="integer", example=1),
 *     @OA\Property(property="equipment_info", type="string", nullable=true),
 *     @OA\Property(property="work_steps", type="array", @OA\Items(type="string"), nullable=true),
 *     @OA\Property(property="note", type="string", nullable=true),
 *     @OA\Property(property="is_active", type="boolean", example=true),
 *     @OA\Property(property="classification_rules", type="array", @OA\Items(ref="#/components/schemas/ProcessClassificationRule")),
 *     @OA\Property(property="process_items", type="array", @OA\Items(ref="#/components/schemas/ProcessItem"))
 * )
 *
 * @OA\Schema(
 *     schema="ProcessCreateRequest",
 *     type="object",
 *     required={"process_name", "process_type"},
 *
 *     @OA\Property(property="process_name", type="string", maxLength=100, example="스크린 생산"),
 *     @OA\Property(property="description", type="string", nullable=true),
 *     @OA\Property(property="process_type", type="string", enum={"생산", "검사", "포장", "조립"}),
 *     @OA\Property(property="department", type="string", maxLength=100, nullable=true),
 *     @OA\Property(property="work_log_template", type="string", maxLength=100, nullable=true),
 *     @OA\Property(property="required_workers", type="integer", minimum=1, nullable=true),
 *     @OA\Property(property="equipment_info", type="string", maxLength=255, nullable=true),
 *     @OA\Property(property="work_steps", type="array", @OA\Items(type="string"), nullable=true),
 *     @OA\Property(property="note", type="string", nullable=true),
 *     @OA\Property(property="is_active", type="boolean", nullable=true),
 *     @OA\Property(property="classification_rules", type="array", nullable=true,
 *         description="패턴 기반 분류 규칙",
 *
 *         @OA\Items(
 *             type="object",
 *             required={"rule_type", "matching_type", "condition_value"},
 *
 *             @OA\Property(property="rule_type", type="string", enum={"품목코드", "품목명", "품목구분"}),
 *             @OA\Property(property="matching_type", type="string", enum={"startsWith", "endsWith", "contains", "equals"}),
 *             @OA\Property(property="condition_value", type="string", maxLength=255),
 *             @OA\Property(property="priority", type="integer", minimum=0),
 *             @OA\Property(property="description", type="string", maxLength=255, nullable=true),
 *             @OA\Property(property="is_active", type="boolean")
 *         )
 *     ),
 *     @OA\Property(property="item_ids", type="array", nullable=true,
 *         description="개별 품목 ID 배열",
 *
 *         @OA\Items(type="integer", example=123)
 *     )
 * )
 */
class ProcessApi
{
    /**
     * @OA\Get(
     *     path="/api/v1/processes",
     *     tags={"Process"},
     *     summary="공정 목록 조회",
     *     security={{"ApiKeyAuth": {}}, {"BearerAuth": {}}},
     *
     *     @OA\Parameter(name="page", in="query", @OA\Schema(type="integer", default=1)),
     *     @OA\Parameter(name="size", in="query", @OA\Schema(type="integer", default=20)),
     *     @OA\Parameter(name="q", in="query", description="검색어", @OA\Schema(type="string")),
     *     @OA\Parameter(name="status", in="query", @OA\Schema(type="string", enum={"active", "inactive"})),
     *     @OA\Parameter(name="process_type", in="query", @OA\Schema(type="string", enum={"생산", "검사", "포장", "조립"})),
     *
     *     @OA\Response(response=200, description="성공",
     *
     *         @OA\JsonContent(
     *
     *             @OA\Property(property="success", type="boolean", example=true),
     *             @OA\Property(property="data", type="array", @OA\Items(ref="#/components/schemas/Process"))
     *         )
     *     )
     * )
     */
    public function index() {}

    /**
     * @OA\Get(
     *     path="/api/v1/processes/{id}",
     *     tags={"Process"},
     *     summary="공정 상세 조회",
     *     security={{"ApiKeyAuth": {}}, {"BearerAuth": {}}},
     *
     *     @OA\Parameter(name="id", in="path", required=true, @OA\Schema(type="integer")),
     *
     *     @OA\Response(response=200, description="성공",
     *
     *         @OA\JsonContent(
     *
     *             @OA\Property(property="success", type="boolean", example=true),
     *             @OA\Property(property="data", ref="#/components/schemas/Process")
     *         )
     *     )
     * )
     */
    public function show() {}

    /**
     * @OA\Post(
     *     path="/api/v1/processes",
     *     tags={"Process"},
     *     summary="공정 생성",
     *     security={{"ApiKeyAuth": {}}, {"BearerAuth": {}}},
     *
     *     @OA\RequestBody(required=true,
     *
     *         @OA\JsonContent(ref="#/components/schemas/ProcessCreateRequest")
     *     ),
     *
     *     @OA\Response(response=201, description="생성됨",
     *
     *         @OA\JsonContent(
     *
     *             @OA\Property(property="success", type="boolean", example=true),
     *             @OA\Property(property="message", type="string", example="message.created"),
     *             @OA\Property(property="data", ref="#/components/schemas/Process")
     *         )
     *     )
     * )
     */
    public function store() {}

    /**
     * @OA\Put(
     *     path="/api/v1/processes/{id}",
     *     tags={"Process"},
     *     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/ProcessCreateRequest")
     *     ),
     *
     *     @OA\Response(response=200, description="성공",
     *
     *         @OA\JsonContent(
     *
     *             @OA\Property(property="success", type="boolean", example=true),
     *             @OA\Property(property="message", type="string", example="message.updated"),
     *             @OA\Property(property="data", ref="#/components/schemas/Process")
     *         )
     *     )
     * )
     */
    public function update() {}
}
