"""
This file is automatically generated. Do not modify it manually.
"""

from .base_api_module import BaseApiModule


class DefectsApiModule(BaseApiModule):
    def list(self, params=None, **kwargs):
        """
        :param dict params: asset: string
        asset__asset_path_cache__path: string
        asset_type__in: string
        component: string
        component_display: string
        created_on: string
        descendants: string
        geometry_exists: string
        latest: string
        layer: string
        layer__in: string
        limit: integer
        location_code: string
        location_code_display: string
        location_zone: string
        location_zone_display: string
        next_inspection_date: string
        offset: integer
        ordering: string
        priority: string
        profile: string
        profile__in: string
        project: string
        project__name: string
        project_selected_findings: string
        project_type__in: string
        related_to: string
        repair_by: string
        search: string
        severity: string
        severity__in: string
        severity_display: string
        state: string
        type: string
        type_display: string

        :returns: properties:
          count:
            type: integer
          next:
            format: uri
            nullable: true
            type: string
          previous:
            format: uri
            nullable: true
            type: string
          results:
            items:
              $ref: '#/components/schemas/DefectList'
            type: array
        required:
        - count
        - results
        type: object

        https://docs.huvrdata.app/reference/api_defects_list
        """
        return self.client.request_json(
            method="get",
            path=f"/api/defects/",
            params=params,
            **kwargs,
        )

    def create(self, json=None, **kwargs):
        """
        :param dict json: $ref: '#/components/requestBodies/DefectCreate'

        :returns: $ref: '#/components/schemas/DefectCreate'

        https://docs.huvrdata.app/reference/api_defects_create
        """
        return self.client.request_json(
            method="post",
            path=f"/api/defects/",
            json=json,
            **kwargs,
        )

    def edit(self, json=None, **kwargs):
        """
        :param dict json: $ref: '#/components/schemas/Defect'

        https://docs.huvrdata.app/reference/api_defects_edit
        """
        return self.client.request_json(
            method="post",
            path=f"/api/defects/bulk-edit/",
            json=json,
            **kwargs,
        )

    def filters(self, params=None, **kwargs):
        """
        Returns defect filter object with the asset, asset manufacturer, asset_owner (company), severity, component, location zone, location code, and count

        No query parameters are supported on this endpoint.

        :param dict params: asset: string
        asset__asset_path_cache__path: string
        asset_type__in: string
        component: string
        component_display: string
        created_on: string
        descendants: string
        geometry_exists: string
        latest: string
        layer: string
        layer__in: string
        limit: integer
        location_code: string
        location_code_display: string
        location_zone: string
        location_zone_display: string
        next_inspection_date: string
        offset: integer
        ordering: string
        priority: string
        profile: string
        profile__in: string
        project: string
        project__name: string
        project_selected_findings: string
        project_type__in: string
        related_to: string
        repair_by: string
        search: string
        severity: string
        severity__in: string
        severity_display: string
        state: string
        type: string
        type_display: string

        :returns: $ref: '#/components/schemas/DefectFilter'

        https://docs.huvrdata.app/reference/api_defects_filters
        """
        return self.client.request_json(
            method="get",
            path=f"/api/defects/filters/",
            params=params,
            **kwargs,
        )

    def link(self, json=None, **kwargs):
        """
        Pass a list of defects,
            will link them (via `Defect.newer_defect` field)
            and return list of updated defects,
            in order

        :param dict json: $ref: '#/components/schemas/DefectLink'

        :returns: items:
          $ref: '#/components/schemas/Defect'
        type: array

        https://docs.huvrdata.app/reference/api_defects_link
        """
        return self.client.request_json(
            method="post",
            path=f"/api/defects/link/",
            json=json,
            **kwargs,
        )

    def read(self, id, **kwargs):
        """
        :returns: $ref: '#/components/schemas/Defect'

        https://docs.huvrdata.app/reference/api_defects_read
        """
        return self.client.request_json(
            method="get",
            path=f"/api/defects/{id}/",
            **kwargs,
        )

    def update(self, id, json=None, **kwargs):
        """
        :param dict json: $ref: '#/components/requestBodies/DefectCreate'

        :returns: $ref: '#/components/schemas/Defect'

        https://docs.huvrdata.app/reference/api_defects_update
        """
        return self.client.request_json(
            method="put",
            path=f"/api/defects/{id}/",
            json=json,
            **kwargs,
        )

    def partial_update(self, id, json=None, **kwargs):
        """
        :param dict json: $ref: '#/components/requestBodies/DefectCreate'

        :returns: $ref: '#/components/schemas/DefectCreate'

        https://docs.huvrdata.app/reference/api_defects_partial_update
        """
        return self.client.request_json(
            method="patch",
            path=f"/api/defects/{id}/",
            json=json,
            **kwargs,
        )

    def delete(self, id, **kwargs):
        """
        https://docs.huvrdata.app/reference/api_defects_delete
        """
        return self.client.request_json(
            method="delete",
            path=f"/api/defects/{id}/",
            **kwargs,
        )
