{"openapi":"3.0.0","info":{"title":"Access Control System API","version":"1.0.0","description":"API documentation for an employee access control system, including card access, anti-passback validation, attendance queries, manager reports, denied access log review, and current access state tracking.\n"},"servers":[{"description":"SwaggerHub API Auto Mocking","url":"https://virtserver.swaggerhub.com/ntu-1ce/Access_Control_System_API/1.0.0"},{"url":"http://localhost:8080/api/v1","description":"Local development server"}],"tags":[{"name":"Auth","description":"Authentication and current user information"},{"name":"Employees","description":"Employee, department, and job level queries"},{"name":"Access Control","description":"Access events, logs, sites, access points, and access states"},{"name":"Attendance","description":"Employee attendance and working hour queries"},{"name":"Manager Reports","description":"Manager dashboards, team reports, and denied access log review"}],"paths":{"/auth/login":{"post":{"tags":["Auth"],"summary":"Employee login","description":"Employee logs in and receives a JWT token.","security":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"},"example":{"username":"manager@example.com","password":"password123"}}}},"responses":{"200":{"description":"Login successful","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponse"},"example":{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6...","employee":{"employeeId":1001,"employeeName":"Kevin Lin","email":"kevin@example.com","phone":"0912345678","jobTitle":"IT Manager","isActive":true,"department":{"departmentId":10,"departmentName":"IT Department","parentDepartmentId":1},"jobLevel":{"jobLevelId":2,"jobLevelName":"Manager","level":2}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/auth/me":{"get":{"tags":["Auth"],"summary":"Get current login employee profile","description":"Returns the profile of the employee represented by the JWT token.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Current employee profile","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeProfile"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/employees":{"get":{"tags":["Employees"],"summary":"Get employees visible to current user","description":"Returns employees within the current user's authorization scope. Managers can view employees in their department scope with lower job levels. Regular employees can only view their own data.\n","security":[{"bearerAuth":[]}],"parameters":[{"name":"keyword","in":"query","required":false,"schema":{"type":"string"},"description":"Search by employee name, email, phone, or job title."},{"name":"jobLevelId","in":"query","required":false,"schema":{"type":"integer"}},{"name":"departmentId","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Employee list","content":{"application/json":{"schema":{"type":"object","properties":{"employees":{"type":"array","items":{"$ref":"#/components/schemas/EmployeeProfile"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/employees/{employeeId}":{"get":{"tags":["Employees"],"summary":"Get employee detail","description":"Returns employee detail if the current user has permission.","security":[{"bearerAuth":[]}],"parameters":[{"name":"employeeId","in":"path","required":true,"schema":{"type":"integer"},"example":1001}],"responses":{"200":{"description":"Employee detail","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeProfile"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/departments":{"get":{"tags":["Employees"],"summary":"Get department list","description":"Returns department list including parent-child department relationship.","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Department list","content":{"application/json":{"schema":{"type":"object","properties":{"departments":{"type":"array","items":{"$ref":"#/components/schemas/Department"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/job-levels":{"get":{"tags":["Employees"],"summary":"Get job level list","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Job level list","content":{"application/json":{"schema":{"type":"object","properties":{"jobLevels":{"type":"array","items":{"$ref":"#/components/schemas/JobLevel"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/access-events":{"post":{"tags":["Access Control"],"summary":"Submit access event","description":"Submit a card tap event from an access control device. The backend validates employee status, access point status, anti-passback state, records the access log, and updates AccessState only when the event is accepted.\n","security":[{"deviceApiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccessEventRequest"},"example":{"employeeId":1001,"accessPointId":501,"direction":"IN","eventTime":"2026-04-26T09:00:00+08:00"}}}},"responses":{"200":{"description":"Access decision result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccessDecision"},"example":{"logId":90001,"employeeId":1001,"siteId":1,"accessPointId":501,"direction":"IN","result":"ACCEPT","reason":"ACCESS_GRANTED","eventTime":"2026-04-26T09:00:00+08:00"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/access-logs":{"get":{"tags":["Access Control"],"summary":"Query access logs","description":"Query access logs. Managers can only query logs within their permission scope. Employees can only query their own logs.\n","security":[{"bearerAuth":[]}],"parameters":[{"name":"employeeId","in":"query","required":false,"schema":{"type":"integer"}},{"name":"siteId","in":"query","required":false,"schema":{"type":"integer"}},{"name":"accessPointId","in":"query","required":false,"schema":{"type":"integer"}},{"name":"startDate","in":"query","required":true,"schema":{"type":"string","format":"date"},"example":"2026-04-01"},{"name":"endDate","in":"query","required":true,"schema":{"type":"string","format":"date"},"example":"2026-04-30"},{"name":"result","in":"query","required":false,"schema":{"$ref":"#/components/schemas/AccessResult"}},{"name":"direction","in":"query","required":false,"schema":{"$ref":"#/components/schemas/AccessDirection"}}],"responses":{"200":{"description":"Access log list","content":{"application/json":{"schema":{"type":"object","properties":{"logs":{"type":"array","items":{"$ref":"#/components/schemas/AccessLog"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/employees/{employeeId}/access-status":{"get":{"tags":["Access Control"],"summary":"Get current access status of an employee","description":"Returns current AccessState information for a specific employee and optional site.","security":[{"bearerAuth":[]}],"parameters":[{"name":"employeeId","in":"path","required":true,"schema":{"type":"integer"},"example":1001},{"name":"siteId","in":"query","required":false,"schema":{"type":"integer"},"description":"If omitted, returns the employee's current status in the default site."}],"responses":{"200":{"description":"Current access status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeAccessStatus"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/sites":{"get":{"tags":["Access Control"],"summary":"Get site list","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Site list","content":{"application/json":{"schema":{"type":"object","properties":{"sites":{"type":"array","items":{"$ref":"#/components/schemas/Site"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/sites/{siteId}/access-points":{"get":{"tags":["Access Control"],"summary":"Get access points by site","security":[{"bearerAuth":[]}],"parameters":[{"name":"siteId","in":"path","required":true,"schema":{"type":"integer"},"example":1}],"responses":{"200":{"description":"Access point list","content":{"application/json":{"schema":{"type":"object","properties":{"accessPoints":{"type":"array","items":{"$ref":"#/components/schemas/AccessPoint"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/me/attendance/summary":{"get":{"tags":["Attendance"],"summary":"Get current employee attendance summary","description":"Returns accumulated working hours and overtime hours for a selected period. If records are missing or denied access logs exist in the period, the result may be marked as incomplete.\n","security":[{"bearerAuth":[]}],"parameters":[{"name":"startDate","in":"query","required":true,"schema":{"type":"string","format":"date"},"example":"2026-04-01"},{"name":"endDate","in":"query","required":true,"schema":{"type":"string","format":"date"},"example":"2026-04-30"}],"responses":{"200":{"description":"Attendance summary","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttendanceSummary"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/me/attendance/daily":{"get":{"tags":["Attendance"],"summary":"Get current employee daily attendance detail","security":[{"bearerAuth":[]}],"parameters":[{"name":"date","in":"query","required":true,"schema":{"type":"string","format":"date"},"example":"2026-04-26"}],"responses":{"200":{"description":"Daily attendance detail","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DailyAttendanceDetail"}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/me/attendance/today-status":{"get":{"tags":["Attendance"],"summary":"Get today's attendance status","description":"Returns estimated off-work time, remaining working time, and denied access alerts. If records are insufficient, calculable will be false and message should show \"目前無法計算\".\n","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Today's attendance status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TodayAttendanceStatus"},"examples":{"calculable":{"value":{"employeeId":1001,"hasCheckInToday":true,"estimatedOffWorkTime":"2026-04-26T18:00:00+08:00","remainingMinutes":120,"calculable":true,"message":"You have 120 minutes remaining.","hasDeniedAccessLog":false}},"notCalculable":{"value":{"employeeId":1001,"hasCheckInToday":false,"estimatedOffWorkTime":null,"remainingMinutes":null,"calculable":false,"message":"目前無法計算","hasDeniedAccessLog":true}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/me/attendance/denied-access-logs":{"get":{"tags":["Attendance"],"summary":"Get current employee denied access logs","description":"Returns the current employee's denied access logs. These logs are treated as abnormal access events.\n","security":[{"bearerAuth":[]}],"parameters":[{"name":"startDate","in":"query","required":false,"schema":{"type":"string","format":"date"}},{"name":"endDate","in":"query","required":false,"schema":{"type":"string","format":"date"}}],"responses":{"200":{"description":"Denied access logs","content":{"application/json":{"schema":{"type":"object","properties":{"logs":{"type":"array","items":{"$ref":"#/components/schemas/AccessLog"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"}}}},"/manager/reports/presence/summary":{"get":{"tags":["Manager Reports"],"summary":"Get current office presence summary","description":"Returns the number of employees currently inside and outside the office within the manager's permission scope. Data is calculated from AccessState.\n","security":[{"bearerAuth":[]}],"parameters":[{"name":"siteId","in":"query","required":false,"schema":{"type":"integer"},"description":"If omitted, uses the default site."}],"responses":{"200":{"description":"Office presence summary","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PresenceSummary"},"example":{"siteId":1,"insideCount":15,"outsideCount":8,"message":"15 employees are currently in the office."}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/manager/reports/presence/employees":{"get":{"tags":["Manager Reports"],"summary":"Get employees currently in office","description":"Returns employees currently inside the selected site within the manager's permission scope. Data is calculated from AccessState.\n","security":[{"bearerAuth":[]}],"parameters":[{"name":"siteId","in":"query","required":false,"schema":{"type":"integer"},"description":"If omitted, uses the default site."},{"name":"keyword","in":"query","required":false,"schema":{"type":"string"},"description":"Search by employee name, job title, email, or phone."},{"name":"jobLevelId","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Employees currently in office","content":{"application/json":{"schema":{"type":"object","properties":{"employees":{"type":"array","items":{"$ref":"#/components/schemas/EmployeePresence"}},"message":{"type":"string","example":"No employees are currently in the office."}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/manager/reports/employees/{employeeId}/monthly-attendance":{"get":{"tags":["Manager Reports"],"summary":"Get monthly attendance chart data for an employee","description":"Returns daily working hours, overtime hours, and access event details for a specific employee. The backend verifies the current user's permission before returning the data.\n","security":[{"bearerAuth":[]}],"parameters":[{"name":"employeeId","in":"path","required":true,"schema":{"type":"integer"},"example":1002},{"name":"yearMonth","in":"query","required":true,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"example":"2026-04"}],"responses":{"200":{"description":"Monthly attendance chart data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmployeeMonthlyAttendanceReport"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/manager/reports/team/workload-trend":{"get":{"tags":["Manager Reports"],"summary":"Get team workload trend","description":"Returns quarterly or yearly average stay-hour trends for employees within the manager's permission scope.\n","security":[{"bearerAuth":[]}],"parameters":[{"name":"periodType","in":"query","required":true,"schema":{"type":"string","enum":["QUARTERLY","YEARLY"]},"example":"QUARTERLY"},{"name":"year","in":"query","required":true,"schema":{"type":"integer"},"example":2026}],"responses":{"200":{"description":"Team workload trend","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamWorkloadTrend"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/manager/reports/team/monthly-statistics":{"get":{"tags":["Manager Reports"],"summary":"Get team monthly attendance statistics","security":[{"bearerAuth":[]}],"parameters":[{"name":"yearMonth","in":"query","required":true,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"example":"2026-04"}],"responses":{"200":{"description":"Team monthly statistics","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamMonthlyStatistics"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/manager/reports/team/stay-hour-distribution":{"get":{"tags":["Manager Reports"],"summary":"Get team stay-hour distribution","security":[{"bearerAuth":[]}],"parameters":[{"name":"yearMonth","in":"query","required":true,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"example":"2026-04"}],"responses":{"200":{"description":"Stay-hour distribution data","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StayHourDistribution"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/manager/reports/denied-access-logs":{"get":{"tags":["Manager Reports"],"summary":"Get denied access logs in manager scope","description":"Returns AccessLog records with result = DENY within the manager's permission scope. These denied logs are used as abnormal access records.\n","security":[{"bearerAuth":[]}],"parameters":[{"name":"startDate","in":"query","required":false,"schema":{"type":"string","format":"date"}},{"name":"endDate","in":"query","required":false,"schema":{"type":"string","format":"date"}},{"name":"reason","in":"query","required":false,"schema":{"$ref":"#/components/schemas/AccessDecisionReason"}},{"name":"keyword","in":"query","required":false,"schema":{"type":"string"},"description":"Search by employee name, job title, email, or phone."},{"name":"sortBy","in":"query","required":false,"schema":{"type":"string","enum":["eventTime","employeeName","reason"]},"example":"eventTime"},{"name":"order","in":"query","required":false,"schema":{"type":"string","enum":["ASC","DESC"]},"example":"DESC"}],"responses":{"200":{"description":"Denied access log list","content":{"application/json":{"schema":{"type":"object","properties":{"logs":{"type":"array","items":{"$ref":"#/components/schemas/AccessLog"}}}}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"}}}},"/manager/reports/denied-access-logs/{logId}":{"get":{"tags":["Manager Reports"],"summary":"Get denied access log detail","description":"Returns one denied AccessLog and the employee's full access sequence on the same date.\n","security":[{"bearerAuth":[]}],"parameters":[{"name":"logId","in":"path","required":true,"schema":{"type":"integer"},"example":90003}],"responses":{"200":{"description":"Denied access log detail","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeniedAccessLogDetail"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}},"/manager/access-logs/{logId}/note":{"patch":{"tags":["Manager Reports"],"summary":"Update access log note","description":"Updates the note field of an AccessLog. This can be used for manager comments on denied access logs. No processing status is stored.\n","security":[{"bearerAuth":[]}],"parameters":[{"name":"logId","in":"path","required":true,"schema":{"type":"integer"},"example":90003}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAccessLogNoteRequest"},"example":{"note":"Confirmed as duplicate IN caused by repeated card tap."}}}},"responses":{"200":{"description":"Note updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccessLog"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"}}}}},"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"deviceApiKey":{"type":"apiKey","in":"header","name":"X-Device-Api-Key"}},"responses":{"BadRequest":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"code":"BAD_REQUEST","message":"Invalid request parameters."}}}},"Unauthorized":{"description":"Unauthorized or invalid token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"code":"UNAUTHORIZED","message":"Please login first."}}}},"Forbidden":{"description":"Permission denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"code":"FORBIDDEN","message":"You do not have permission to access this resource."}}}},"NotFound":{"description":"Resource not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"},"example":{"code":"NOT_FOUND","message":"Resource not found."}}}}},"schemas":{"ErrorResponse":{"type":"object","properties":{"code":{"type":"string","example":"FORBIDDEN"},"message":{"type":"string","example":"You do not have permission to access this resource."}}},"LoginRequest":{"type":"object","required":["username","password"],"properties":{"username":{"type":"string","example":"manager@example.com"},"password":{"type":"string","format":"password","example":"password123"}}},"LoginResponse":{"type":"object","properties":{"token":{"type":"string","example":"eyJhbGciOiJIUzI1NiIsInR5cCI6..."},"employee":{"$ref":"#/components/schemas/EmployeeProfile"}}},"EmployeeProfile":{"type":"object","properties":{"employeeId":{"type":"integer","example":1001},"employeeName":{"type":"string","example":"Kevin Lin"},"email":{"type":"string","format":"email","example":"kevin@example.com"},"phone":{"type":"string","example":"0912345678"},"jobTitle":{"type":"string","example":"Backend Engineer"},"department":{"$ref":"#/components/schemas/Department"},"jobLevel":{"$ref":"#/components/schemas/JobLevel"},"isActive":{"type":"boolean","example":true},"createdAt":{"type":"string","format":"date-time","example":"2026-04-01T10:00:00+08:00"},"updatedAt":{"type":"string","format":"date-time","example":"2026-04-20T10:00:00+08:00"}}},"Department":{"type":"object","properties":{"departmentId":{"type":"integer","example":10},"departmentName":{"type":"string","example":"IT Department"},"parentDepartmentId":{"type":"integer","nullable":true,"example":1},"createdAt":{"type":"string","format":"date-time","example":"2026-04-01T10:00:00+08:00"},"updatedAt":{"type":"string","format":"date-time","example":"2026-04-20T10:00:00+08:00"}}},"JobLevel":{"type":"object","properties":{"jobLevelId":{"type":"integer","example":3},"jobLevelName":{"type":"string","example":"Engineer"},"level":{"type":"integer","description":"Smaller number means higher authority. Example: 1 is higher than 3.","example":3},"createdAt":{"type":"string","format":"date-time","example":"2026-04-01T10:00:00+08:00"},"updatedAt":{"type":"string","format":"date-time","example":"2026-04-20T10:00:00+08:00"}}},"Site":{"type":"object","properties":{"siteId":{"type":"integer","example":1},"siteName":{"type":"string","example":"Taipei Office"},"siteAddress":{"type":"string","example":"Taipei City"},"createdAt":{"type":"string","format":"date-time","example":"2026-04-01T10:00:00+08:00"},"updatedAt":{"type":"string","format":"date-time","example":"2026-04-20T10:00:00+08:00"}}},"AccessPoint":{"type":"object","properties":{"accessPointId":{"type":"integer","example":501},"siteId":{"type":"integer","example":1},"accessPointName":{"type":"string","example":"Main Entrance"},"locationDescription":{"type":"string","example":"1F Lobby"},"isActive":{"type":"boolean","example":true},"createdAt":{"type":"string","format":"date-time","example":"2026-04-01T10:00:00+08:00"},"updatedAt":{"type":"string","format":"date-time","example":"2026-04-20T10:00:00+08:00"}}},"AccessDirection":{"type":"string","enum":["IN","OUT"]},"AccessResult":{"type":"string","enum":["ACCEPT","DENY"]},"AccessDecisionReason":{"type":"string","enum":["ACCESS_GRANTED","ANTI_PASSBACK_VIOLATION","EMPLOYEE_NOT_FOUND","ACCESS_POINT_NOT_FOUND","INACTIVE_EMPLOYEE","INACTIVE_ACCESS_POINT","INVALID_DIRECTION"]},"AccessEventRequest":{"type":"object","required":["employeeId","accessPointId","direction"],"properties":{"employeeId":{"type":"integer","example":1001},"accessPointId":{"type":"integer","example":501},"direction":{"$ref":"#/components/schemas/AccessDirection"},"eventTime":{"type":"string","format":"date-time","description":"Optional. If not provided, the server uses current server time.","example":"2026-04-26T09:00:00+08:00"}}},"AccessDecision":{"type":"object","properties":{"logId":{"type":"integer","example":90001},"employeeId":{"type":"integer","example":1001},"siteId":{"type":"integer","example":1},"accessPointId":{"type":"integer","example":501},"direction":{"$ref":"#/components/schemas/AccessDirection"},"result":{"$ref":"#/components/schemas/AccessResult"},"reason":{"$ref":"#/components/schemas/AccessDecisionReason"},"eventTime":{"type":"string","format":"date-time","example":"2026-04-26T09:00:00+08:00"}}},"AccessLog":{"type":"object","properties":{"logId":{"type":"integer","example":90001},"employeeId":{"type":"integer","example":1001},"employeeName":{"type":"string","example":"Kevin Lin"},"siteId":{"type":"integer","example":1},"siteName":{"type":"string","example":"Taipei Office"},"accessPointId":{"type":"integer","example":501},"accessPointName":{"type":"string","example":"Main Entrance"},"direction":{"$ref":"#/components/schemas/AccessDirection"},"result":{"$ref":"#/components/schemas/AccessResult"},"reason":{"$ref":"#/components/schemas/AccessDecisionReason"},"eventTime":{"type":"string","format":"date-time","example":"2026-04-26T09:00:00+08:00"},"note":{"type":"string","nullable":true,"example":"Consecutive IN detected."},"createdAt":{"type":"string","format":"date-time","example":"2026-04-26T09:00:01+08:00"}}},"AccessState":{"type":"object","properties":{"stateId":{"type":"integer","example":1},"employeeId":{"type":"integer","example":1001},"siteId":{"type":"integer","example":1},"currentState":{"type":"string","enum":["INSIDE","OUTSIDE","UNKNOWN"],"example":"INSIDE"},"lastLogId":{"type":"integer","example":90001},"lastAccessPointId":{"type":"integer","example":501},"lastDirection":{"$ref":"#/components/schemas/AccessDirection"},"lastTimestamp":{"type":"string","format":"date-time","example":"2026-04-26T09:00:00+08:00"},"updatedAt":{"type":"string","format":"date-time","example":"2026-04-26T09:00:01+08:00"}}},"EmployeeAccessStatus":{"type":"object","properties":{"employeeId":{"type":"integer","example":1001},"siteId":{"type":"integer","example":1},"isInside":{"type":"boolean","example":true},"currentState":{"type":"string","enum":["INSIDE","OUTSIDE","UNKNOWN"],"example":"INSIDE"},"lastLogId":{"type":"integer","example":90001},"lastDirection":{"$ref":"#/components/schemas/AccessDirection"},"lastTimestamp":{"type":"string","format":"date-time","example":"2026-04-26T09:00:00+08:00"},"lastAccessPointId":{"type":"integer","example":501}}},"AttendanceSummary":{"type":"object","properties":{"employeeId":{"type":"integer","example":1001},"startDate":{"type":"string","format":"date","example":"2026-04-01"},"endDate":{"type":"string","format":"date","example":"2026-04-30"},"totalWorkingHours":{"type":"number","format":"double","example":168.5},"totalOvertimeHours":{"type":"number","format":"double","example":12.5},"isComplete":{"type":"boolean","example":false},"message":{"type":"string","example":"結果不完整"},"incompleteDates":{"type":"array","items":{"type":"string","format":"date"},"example":["2026-04-08","2026-04-19"]},"deniedAccessLogCount":{"type":"integer","example":2}}},"DailyAttendanceDetail":{"type":"object","properties":{"employeeId":{"type":"integer","example":1001},"date":{"type":"string","format":"date","example":"2026-04-26"},"workingHours":{"type":"number","format":"double","example":8.5},"overtimeHours":{"type":"number","format":"double","example":0.5},"isComplete":{"type":"boolean","example":true},"accessEvents":{"type":"array","items":{"$ref":"#/components/schemas/AccessLog"}},"deniedAccessLogs":{"type":"array","items":{"$ref":"#/components/schemas/AccessLog"}}}},"TodayAttendanceStatus":{"type":"object","properties":{"employeeId":{"type":"integer","example":1001},"hasCheckInToday":{"type":"boolean","example":true},"estimatedOffWorkTime":{"type":"string","format":"date-time","nullable":true,"example":"2026-04-26T18:00:00+08:00"},"remainingMinutes":{"type":"integer","nullable":true,"example":120},"calculable":{"type":"boolean","example":true},"message":{"type":"string","example":"You have 120 minutes remaining."},"hasDeniedAccessLog":{"type":"boolean","example":false}}},"PresenceSummary":{"type":"object","properties":{"siteId":{"type":"integer","example":1},"insideCount":{"type":"integer","example":15},"outsideCount":{"type":"integer","example":8},"message":{"type":"string","example":"15 employees are currently in the office."}}},"EmployeePresence":{"type":"object","properties":{"employeeId":{"type":"integer","example":1002},"employeeName":{"type":"string","example":"Amy Chen"},"jobTitle":{"type":"string","example":"Backend Engineer"},"jobLevelName":{"type":"string","example":"Engineer"},"email":{"type":"string","format":"email","example":"amy@example.com"},"phone":{"type":"string","example":"0922333444"},"siteId":{"type":"integer","example":1},"isInside":{"type":"boolean","example":true},"lastAccessTime":{"type":"string","format":"date-time","example":"2026-04-26T09:10:00+08:00"}}},"EmployeeMonthlyAttendanceReport":{"type":"object","properties":{"employeeId":{"type":"integer","example":1002},"employeeName":{"type":"string","example":"Amy Chen"},"yearMonth":{"type":"string","example":"2026-04"},"totalWorkingHours":{"type":"number","example":168.5},"totalOvertimeHours":{"type":"number","example":12.5},"averageDailyWorkingHours":{"type":"number","example":8.4},"averageDailyOvertimeHours":{"type":"number","example":0.6},"overtimeWarning":{"type":"boolean","description":"True when average overtime is greater than the third quartile.","example":true},"dailyRecords":{"type":"array","items":{"$ref":"#/components/schemas/DailyWorkRecord"}}}},"DailyWorkRecord":{"type":"object","properties":{"date":{"type":"string","format":"date","example":"2026-04-01"},"workingHours":{"type":"number","example":9.5},"overtimeHours":{"type":"number","example":1.5},"overEightHours":{"type":"boolean","example":true},"isComplete":{"type":"boolean","example":true},"accessEvents":{"type":"array","items":{"$ref":"#/components/schemas/AccessLog"}},"deniedAccessLogs":{"type":"array","items":{"$ref":"#/components/schemas/AccessLog"}}}},"TeamWorkloadTrend":{"type":"object","properties":{"periodType":{"type":"string","enum":["QUARTERLY","YEARLY"],"example":"QUARTERLY"},"data":{"type":"array","items":{"type":"object","properties":{"period":{"type":"string","example":"2026-Q1"},"averageStayHours":{"type":"number","format":"double","example":8.3}}}}}},"TeamMonthlyStatistics":{"type":"object","properties":{"yearMonth":{"type":"string","example":"2026-04"},"statisticsEndDate":{"type":"string","format":"date","description":"If the queried month is the current month, this field shows the date up to which data is counted.","example":"2026-04-26"},"isCurrentMonth":{"type":"boolean","example":true},"averageDailyStayHours":{"type":"number","example":8.2},"averageDailyStayHoursDiffFromPreviousMonth":{"type":"number","description":"Difference from previous month in hours.","example":0.5},"averageCheckInTime":{"type":"string","example":"09:12"},"averageCheckInTimeDiffMinutes":{"type":"integer","description":"Difference from previous month in minutes.","example":8},"averageCheckOutTime":{"type":"string","example":"18:21"},"averageCheckOutTimeDiffMinutes":{"type":"integer","description":"Difference from previous month in minutes.","example":12}}},"StayHourDistribution":{"type":"object","properties":{"yearMonth":{"type":"string","example":"2026-04"},"q1":{"type":"number","example":7.5},"median":{"type":"number","example":8.1},"q3":{"type":"number","example":9.2},"min":{"type":"number","example":5.5},"max":{"type":"number","example":12.3},"outliers":{"type":"array","items":{"type":"object","properties":{"employeeId":{"type":"integer","example":1005},"employeeName":{"type":"string","example":"David Wang"},"averageStayHours":{"type":"number","example":12.3}}}}}},"DeniedAccessLogDetail":{"type":"object","properties":{"deniedAccessLog":{"$ref":"#/components/schemas/AccessLog"},"dailyAccessSequence":{"type":"array","items":{"$ref":"#/components/schemas/AccessLog"}}}},"UpdateAccessLogNoteRequest":{"type":"object","required":["note"],"properties":{"note":{"type":"string","nullable":true,"example":"Confirmed as duplicate IN caused by repeated card tap."}}}}}}