package com.example.ops_android.data.model

import com.example.ops_android.data.remote.api.LinkedCustomer
import com.google.gson.annotations.SerializedName

data class WorkOrder(
    @SerializedName("ID") val id: Int = 0,
    @SerializedName("Title") val title: String? = null,
    @SerializedName("Description") val description: String? = null,
    @SerializedName("CurrentStatus") val status: String? = null,
    @SerializedName("CreatedAt") val created_at: String? = null,
    @SerializedName("UpdatedAt") val updated_at: String? = null,
    @SerializedName("UserID") val user_id: Int? = null,
    // Filled from detail API
    @kotlin.jvm.Transient val commits: List<Commit>? = null,
    @kotlin.jvm.Transient val linkedCustomers: List<LinkedCustomer>? = null
)

data class WorkOrderCommit(
    @SerializedName("ID") val id: Int = 0,
    @SerializedName("WorkOrderID") val workOrderId: Int = 0,
    @SerializedName("UserID") val userId: Int = 0,
    @SerializedName("Action") val action: String? = null,
    @SerializedName("Status") val status: String? = null,
    @SerializedName("OldStatus") val oldStatus: String? = null,
    @SerializedName("Comment") val comment: String? = null,
    @SerializedName("IP") val ip: String? = null,
    @SerializedName("CreatedAt") val created_at: String? = null,
    @SerializedName("photos") val photos: List<TabFileInfo>? = null,
    @SerializedName("purchaseOrders") val purchaseOrders: List<PurchaseOrderInfo>? = null
)

data class TabFileInfo(
    @SerializedName("ID") val id: Int = 0,
    @SerializedName("Name") val name: String? = null,
    @SerializedName("Sha256") val sha256: String? = null,
    @SerializedName("Path") val path: String? = null,
    @SerializedName("Type") val type: String? = null
)

data class PurchaseOrderInfo(
    @SerializedName("id") val id: Int = 0,
    @SerializedName("title") val title: String? = null,
    @SerializedName("status") val status: String? = null
)

// Keep backward compat
typealias Commit = WorkOrderCommit
