{"openapi":"3.0.3","info":{"title":"AbseniNaja API - Super Admin","description":"Dokumentasi API untuk endpoint Super Admin pada sistem AbseniNaja. Semua endpoint memerlukan autentikasi Bearer token dengan role 'super admin'.","version":"1.0.0"},"servers":[{"url":"https://services.abseninaja.com/api/v1","description":"Production Server"},{"url":"http://localhost:4000/api/v1","description":"Local Development Server"}],"tags":[{"name":"Super Admin - Approved Sekolah","description":"Manajemen sekolah yang sudah di-approve"},{"name":"Super Admin - Pendaftaran Sekolah","description":"Manajemen pendaftaran sekolah baru"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"JWT Access Token. Diperoleh dari endpoint login."}},"schemas":{"ErrorResponse":{"type":"object","properties":{"message":{"type":"string","example":"Internal Server Error"}}},"UnauthorizedResponse":{"type":"object","properties":{"msg":{"type":"string","example":"Akses ditolak. Silakan login kembali"}}},"SekolahApproved":{"type":"object","properties":{"id":{"type":"integer","example":1},"nama":{"type":"string","example":"SMA Negeri 1 Jakarta"},"nama_admin":{"type":"string","example":"Budi Santoso"},"npsn":{"type":"string","example":"20100001"},"alamat":{"type":"string","example":"Jl. Merdeka No. 1, Jakarta"}}},"SekolahApprovedDetail":{"type":"object","properties":{"id":{"type":"integer","example":1},"nama_admin":{"type":"string","example":"Budi Santoso"},"email":{"type":"string","example":"admin@sma1jakarta.sch.id"},"nama":{"type":"string","example":"SMA Negeri 1 Jakarta"}}},"PendaftaranSekolah":{"type":"object","properties":{"id":{"type":"integer","example":1},"nama":{"type":"string","example":"SMA Negeri 1 Jakarta"},"nama_admin":{"type":"string","example":"Budi Santoso"},"npsn":{"type":"string","example":"20100001"},"alamat":{"type":"string","example":"Jl. Merdeka No. 1, Jakarta"},"timezone_sekolah":{"type":"string","example":"Asia/Jakarta"},"created_at":{"type":"string","example":"09-05-2026/08:30:00"},"StatusPendaftaran":{"type":"object","properties":{"status_pendaftaran":{"type":"string","example":"Menunggu"}}}}},"AddPendaftaranRequest":{"type":"object","required":["nama","npsn","kepala_sekolah","nama_admin","email","kontak_admin"],"properties":{"nama":{"type":"string","minLength":3,"maxLength":255,"example":"SMA Negeri 1 Jakarta"},"npsn":{"type":"string","pattern":"^[0-9]{8}$","example":"20100001","description":"8 digit angka"},"kepala_sekolah":{"type":"string","minLength":3,"maxLength":255,"example":"Dr. Ahmad Fauzi"},"alamat":{"type":"string","example":"Jl. Merdeka No. 1, Jakarta"},"nama_admin":{"type":"string","minLength":3,"maxLength":255,"example":"Budi Santoso"},"email":{"type":"string","format":"email","example":"admin@sma1jakarta.sch.id"},"kontak_admin":{"type":"string","minLength":10,"maxLength":50,"example":"081234567890"},"jumlah_siswa":{"type":"integer","minimum":0,"example":500},"jumlah_guru":{"type":"integer","minimum":0,"example":40},"jumlah_staf":{"type":"integer","minimum":0,"example":10},"timezone_sekolah":{"type":"string","enum":["Asia/Jakarta","Asia/Makassar","Asia/Jayapura"],"default":"Asia/Jakarta","example":"Asia/Jakarta"}}},"UpdatePendaftaranRequest":{"type":"object","required":["status_id"],"properties":{"status_id":{"type":"integer","example":3,"description":"ID status pendaftaran (misal: 1=Menunggu, 2=Proses, 3=Approved)"}}},"AddAdminSekolahRequest":{"type":"object","required":["password","sekolah_id"],"properties":{"password":{"type":"string","minLength":6,"example":"password123"},"sekolah_id":{"type":"integer","example":1}}},"StatusPendaftaran":{"type":"object","properties":{"id":{"type":"integer","example":1},"status_pendaftaran":{"type":"string","example":"Menunggu"}}}}},"security":[{"bearerAuth":[]}],"paths":{"/super-admin/approved":{"get":{"tags":["Super Admin - Approved Sekolah"],"summary":"Daftar semua sekolah yang sudah di-approve","description":"Mengambil semua sekolah dengan status_id = 3 (approved).","operationId":"getApprovedSchools","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Daftar sekolah approved berhasil diambil","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SekolahApproved"}},"example":[{"id":1,"nama":"SMA Negeri 1 Jakarta","nama_admin":"Budi Santoso","npsn":"20100001","alamat":"Jl. Merdeka No. 1, Jakarta"}]}}},"401":{"description":"Token tidak ditemukan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Akses ditolak (bukan super admin atau token tidak valid)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/super-admin/approved/{sekolah_id}":{"get":{"tags":["Super Admin - Approved Sekolah"],"summary":"Detail sekolah approved berdasarkan ID","description":"Mengambil detail sekolah yang sudah di-approve berdasarkan sekolah_id.","operationId":"getApprovedSchoolById","security":[{"bearerAuth":[]}],"parameters":[{"name":"sekolah_id","in":"path","required":true,"schema":{"type":"integer"},"example":1,"description":"ID sekolah yang sudah di-approve"}],"responses":{"200":{"description":"Detail sekolah berhasil diambil","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SekolahApprovedDetail"}}}},"401":{"description":"Token tidak ditemukan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Akses ditolak","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"404":{"description":"Sekolah tidak ditemukan atau belum di-approve","content":{"application/json":{"schema":{"type":"object","properties":{"msg":{"type":"string","example":"Sekolah tidak ditemukan atau belum di-approve"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/super-admin/approved/admin-sekolah":{"post":{"tags":["Super Admin - Approved Sekolah"],"summary":"Tambah akun admin sekolah","description":"Membuat akun User baru dengan role admin sekolah (role_id=2) dan menghubungkannya ke sekolah yang sudah di-approve.","operationId":"addAccountAdminSekolah","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddAdminSekolahRequest"},"example":{"password":"password123","sekolah_id":1}}}},"responses":{"201":{"description":"Admin sekolah berhasil ditambahkan","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Admin sekolah SMA Negeri 1 Jakarta berhasil ditambahkan"}}}}}},"400":{"description":"Validasi gagal","content":{"application/json":{"schema":{"type":"object","properties":{"msg":{"type":"string"},"errors":{"type":"array","items":{"type":"string"}}}}}}},"401":{"description":"Token tidak ditemukan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Akses ditolak","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"404":{"description":"Sekolah tidak ditemukan","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Sekolah tidak ditemukan"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/super-admin/pendaftaran/form":{"get":{"tags":["Super Admin - Pendaftaran Sekolah"],"summary":"Daftar semua pendaftaran sekolah","description":"Mengambil seluruh data pendaftaran sekolah beserta status pendaftarannya. Waktu ditampilkan dalam format WIB (Asia/Jakarta).","operationId":"getPendaftaranForm","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Daftar pendaftaran berhasil diambil","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PendaftaranSekolah"}},"example":[{"id":1,"nama":"SMA Negeri 1 Jakarta","nama_admin":"Budi Santoso","npsn":"20100001","alamat":"Jl. Merdeka No. 1, Jakarta","timezone_sekolah":"Asia/Jakarta","created_at":"09-05-2026/08:30:00","StatusPendaftaran":{"status_pendaftaran":"Menunggu"}}]}}},"401":{"description":"Token tidak ditemukan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Akses ditolak","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"msg":{"type":"string","example":"Internal Server Error"}}}}}}}}},"/super-admin/pendaftaran/status":{"get":{"tags":["Super Admin - Pendaftaran Sekolah"],"summary":"Daftar status pendaftaran (dropdown)","description":"Mengambil seluruh pilihan status pendaftaran sekolah untuk keperluan dropdown.","operationId":"getStatusPendaftaran","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Daftar status berhasil diambil","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/StatusPendaftaran"}},"example":[{"id":1,"status_pendaftaran":"Menunggu"},{"id":2,"status_pendaftaran":"Proses"},{"id":3,"status_pendaftaran":"Approved"}]}}},"401":{"description":"Token tidak ditemukan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Akses ditolak","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string","example":"Internal Server Error"}}}}}}}}},"/super-admin/pendaftaran/{id}":{"get":{"tags":["Super Admin - Pendaftaran Sekolah"],"summary":"Detail pendaftaran sekolah berdasarkan ID","description":"Mengambil data lengkap satu pendaftaran sekolah berdasarkan ID-nya.","operationId":"getPendaftaranSekolahById","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"example":1,"description":"ID pendaftaran sekolah"}],"responses":{"200":{"description":"Data pendaftaran berhasil diambil","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddPendaftaranRequest"}}}},"401":{"description":"Token tidak ditemukan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Akses ditolak","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"404":{"description":"Sekolah tidak ditemukan","content":{"application/json":{"schema":{"type":"object","properties":{"msg":{"type":"string","example":"Sekolah tidak ditemukan"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"msg":{"type":"string","example":"Internal Server Error"}}}}}}}},"put":{"tags":["Super Admin - Pendaftaran Sekolah"],"summary":"Update status pendaftaran sekolah","description":"Mengubah status pendaftaran sekolah (misal: dari Menunggu ke Approved). Hanya field `status_id` yang dapat diubah.","operationId":"updatePendaftaranSekolah","security":[{"bearerAuth":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"},"example":1,"description":"ID pendaftaran sekolah"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdatePendaftaranRequest"},"example":{"status_id":3}}}},"responses":{"200":{"description":"Status pendaftaran berhasil diperbarui","content":{"application/json":{"schema":{"type":"object","properties":{"msg":{"type":"string","example":"Status pendaftaran sekolah SMA Negeri 1 Jakarta berhasil diperbarui"},"data":{"$ref":"#/components/schemas/AddPendaftaranRequest"}}}}}},"400":{"description":"Validasi gagal","content":{"application/json":{"schema":{"type":"object","properties":{"msg":{"type":"string","example":"Validasi gagal"},"errors":{"type":"array","items":{"type":"string"}}}}}}},"401":{"description":"Token tidak ditemukan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Akses ditolak","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"404":{"description":"Pendaftaran tidak ditemukan","content":{"application/json":{"schema":{"type":"object","properties":{"msg":{"type":"string","example":"Pendaftaran tidak ditemukan"}}}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"msg":{"type":"string","example":"Internal Server Error"}}}}}}}}},"/super-admin/pendaftaran":{"post":{"tags":["Super Admin - Pendaftaran Sekolah"],"summary":"Tambah pendaftaran sekolah baru","description":"Mendaftarkan sekolah baru ke sistem. NPSN harus unik. Status awal otomatis diset ke 1 (Menunggu). Timezone default adalah Asia/Jakarta jika tidak disertakan.","operationId":"addPendaftaranForm","security":[{"bearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddPendaftaranRequest"},"example":{"nama":"SMA Negeri 1 Jakarta","npsn":"20100001","kepala_sekolah":"Dr. Ahmad Fauzi","alamat":"Jl. Merdeka No. 1, Jakarta","nama_admin":"Budi Santoso","email":"admin@sma1jakarta.sch.id","kontak_admin":"081234567890","jumlah_siswa":500,"jumlah_guru":40,"jumlah_staf":10,"timezone_sekolah":"Asia/Jakarta"}}}},"responses":{"201":{"description":"Pendaftaran sekolah berhasil dibuat","content":{"application/json":{"schema":{"type":"object","properties":{"msg":{"type":"string","example":"Pendaftaran sekolah SMA Negeri 1 Jakarta berhasil"},"data":{"$ref":"#/components/schemas/AddPendaftaranRequest"}}}}}},"400":{"description":"Validasi gagal atau NPSN sudah terdaftar","content":{"application/json":{"schema":{"type":"object","properties":{"msg":{"type":"string","example":"NPSN sudah terdaftar dalam sistem"}}}}}},"401":{"description":"Token tidak ditemukan","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"403":{"description":"Akses ditolak","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedResponse"}}}},"500":{"description":"Internal Server Error","content":{"application/json":{"schema":{"type":"object","properties":{"msg":{"type":"string","example":"Internal Server Error"}}}}}}}}}}}