# -*- coding: utf-8 -*-
from odoo import fields, models


class FamilyLawParty(models.Model):
    _name = "familylaw.party"
    _description = "Case Party"
    _inherit = ["mail.thread", "mail.activity.mixin"]
    _order = "role, name"

    case_id = fields.Many2one(
        "familylaw.case",
        required=True,
        ondelete="cascade",
        index=True,
    )
    partner_id = fields.Many2one(
        "res.partner",
        string="Contact Record",
        help="Link to an existing contact. Name is copied to the Name field.",
    )
    name = fields.Char(
        required=True,
        tracking=True,
        help="Full legal name of this party.",
    )
    role = fields.Selection(
        selection=[
            ("client", "Client"),
            ("opposing_party", "Opposing Party"),
            ("opposing_counsel", "Opposing Counsel"),
            ("other", "Other"),
        ],
        required=True,
        default="opposing_party",
        tracking=True,
    )
    notes = fields.Text()
