# -*- coding: utf-8 -*-

from datetime import datetime
from typing import Optional

from sqlmodel import Column, DateTime, Field, Relationship, SQLModel


class Device(SQLModel, table=True):  # type: ignore
    """The Device model.

    It is used to model a device.
    """

    # setup the primary key of the table
    uuid: str = Field(primary_key=True)

    # setup the columns / properties
    name: Optional[str]
    type: Optional[str]
    arch: Optional[str]
    cpid: Optional[str]
    cpu_type: Optional[str]
    cpu_architecture: Optional[str]
    cpu_features: Optional[str]
    processor_count: Optional[int]
    coprocessor_count: Optional[int]
    product_name: Optional[str]
    floating_point_speed: Optional[float]
    integer_speed: Optional[float]
    total_disk_space: Optional[float]
    free_disk_space: Optional[float]
    swap_space: Optional[float]
    domain_name: Optional[str]
    operating_system_version: Optional[str]
    boinc_version: Optional[str]
    scitizen_version: Optional[str]
    platform: Optional[str]

    # setup the pseudo-columns (metadata related to the record)
    created_at: Optional[datetime] = Field(
        sa_column=Column(